Do not print file names in zgrep output when searching for multiple files

When I use zgrep to search for multiple .gz files, the output contains the file name in it. Sometimes I don’t need it. Bcz I use some other scripts to analyze the output.

I tried using the -h option, but it does not 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 printing a file name?

+4
source share
1 answer

-hdoes not work for zgrep, but the equivalent --no-filename option does. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434429

EDIT @ValarDohaeris, , -, 1.6. , 1.5. ​​ .

+12

All Articles