#!/usr/bin/perl # # strings(1) # # mjd-perl-strings@plover.com # # Caution: Assumes ASCII. $length = 4; while ($ARGV[0] =~ /^-/) { my $opt = shift; last if $opt eq '--'; if ($opt =~ /^-(\d+)$/ ) { $length = $1 || shift; } elsif ($opt =~ /^-o/) { $opt_o++; } else { die <) { while (/$pat/og) { printf "%07d ", ($l+pos()-length $&) if $opt_o; print $&, "\n" ; } $l += length; } continue { $l = 0 if eof }