#!/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/; }