I\'m grabbing a few columns from a tab delineated file in Perl. The first line of the file is completely different from the other lines, so I\'d like to skip that line as fast a
I had a similar question/issue. My solution was the following - for either unzipped or gzipped files:
print STDERR "\nReading input file...\n";
if ($file =~ /.gz$/) {
open(IN, "gunzip -c $file | grep -v '##' |") or die " *** ERROR *** Cannot open pipe to [ $file ]!\n";
} else {
open(IN, "cat $file | grep -v '##' |") or die " *** ERROR *** Cannot open [ $file ]!\n";
}
I don't know about benchmarking, but it works fine for me.
Best,
Sander