in reply to Re: Searching a gzip file
in thread Searching a gzip file

open FILE, '>log_'.$expt_name.'.txt' or die "Can't open file : $!\n"; print FILE "***********************\n"; my @Ids=`zcat $log_files | sed -e 's/\\\n/\\n/g' | grep -B5 'name\?'| + grep Id`; foreach (@Ids){ print $_."\n"; #Search and print the first occurence of <score> after $_ } close FILE;

There is not much code I have written so far :), trying to figure out which tools to use..thanks

Replies are listed 'Best First'.
Re^3: Searching a gzip file
by Corion (Patriarch) on Aug 26, 2010 at 08:27 UTC

    While I'm not sure why you seem to write a shell script in Perl instead of using the Perl built-in mechanisms, I think if you post about 10 relevant lines of your input data. Your current approach should work regardless of whether the file is compressed or not, so I'm not sure I've understood where you see your problem.