1
1
Fork 0
scripts/lifesaver.pl

10 lines
260 B
Perl
Executable File

#!/usr/bin/perl
#source: http://www.etherealbits.com/2012/06/the-perl-script-that-may-save-your-life/
open(DEV, '/dev/sda1') or die "Can't open: $!\n";
while (read(DEV, $buf, 4096)) {
print tell(DEV), "\n", $buf, "\n"
if $buf =~ /stringtosearchfor/;
}