Advertisement
cd62131

SearchAllPositions

Jul 31st, 2014
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.25 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use feature 'say';
  5. exit unless @ARGV == 2;
  6. my ($path, $search) = @ARGV;
  7. open my $in, '<', $path or die;
  8. while (<$in>) {
  9.   chomp;
  10.   while (/$search/g) {
  11.     say "$-[0] -- $+[0]";
  12.   }
  13. }
  14. close $in;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement