When I use zgrep to search multiple .gz files, the output contains the filename in it. Sometimes I don't need it bcz I use some other scripts to parse the output.
I tried using "-h" option but it doesn't seem to work with zgrep.
This is how I use the command:
admin@mybox [11:16:56]> zgrep -Eh "\.ERR|\.WARNING|\.FATAL" messages.?.gz
messages.1.gz:Oct 14 10:02:06 .............................................
messages.2.gz:Oct 14 09:27:58 .............................................
Any idea how I can stop the filename from being printed?
-h
does not work for zgrep, but the equivalent
--no-filename
option does. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434429
EDIT As @ValarDohaeris suggests, the bug was apparently fixed in 1.6. I don't experience it in that version, while I still do in 1.5. I was not able to find such info in the changelog though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With