1
I thought -H always should print filename before matched line. this is true for grep, but not for bzgrep:
$ grep -H pattern file1
file1: data pattern data
$ bzgrep -H pattern file2.bz2
(standard input): data pattern data
Is there a workaround for this? I need to grep hundreds of bz2 files, I cannot decompress them all before the search...
Try specifying multiple files on the command line – golimar – 2014-03-20T11:49:41.190
command line would be too short for that. There are hundreds of files to be searched. I will use bzgrep in a 'for' loop, where variable will be filename taken from a list, as the files are in different directories. – Washuu – 2014-03-20T11:53:57.680
Then create an empty file and grep both the bz2 file and the empty file each time – golimar – 2014-03-20T12:01:10.210
It is something like workaround, thank you. The only drawback is that the filename will be in separate line, what needs to be parsed correctly. I wonder, however, why such bug went unnoticed. Perhaps I have too old version of bzgrep? I will try to test it on newest CentOS. – Washuu – 2014-03-20T12:12:31.750