Using sed on a compressed file

Viewed 22518

I have written a file processing program and now it needs to read from a zipped file(.gz unzipped file may get as large as 2TB),

Is there a sed equivalent for zipped files like (zcat/cat) or else what would be the best approach to do the following efficiently

    ONE=`zcat filename.gz| sed -n $counts`

$counts : counter to read(line by line)

The above method works, but is quite slow for large file as I need to read each line and perform the matching on certain fields.

Thanks

EDIT

Though not directly helpful, here are a set of zcommands

http://www.cyberciti.biz/tips/decompress-and-expand-text-files.html

2 Answers
Related