in reply to Searching within compressed files
would something like this work? I am assuming you are on a system where zcat works on .Z and .gz files. For other compressions use corresponding utility and pipe it to Perl.
cheers
SK Update: Here is a snippet. Sorry I couldn't get the file reading and matching in one line :(
#!/usr/local/bin/perl -w my $myfile = "test.gz"; open(IN,"zcat $myfile|") or die "Cannot open file: $myfile\n"; while (<IN>) { print ($_) if /mymatch/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Searching within compressed files
by revdiablo (Prior) on Apr 15, 2005 at 18:22 UTC | |
|
Re^2: Searching within compressed files
by Anonymous Monk on Apr 15, 2005 at 16:48 UTC |