I frequently use the commands like

find . ! -iname "*test*" -o -iname "*foo*" | xargs zgrep -ie first.*last -e last.*first

I use zgrep because it can grep through .gz files, and if the files aren't gzipped it simply uses grep. However I frequently get

gzip: copy.txt.gz: No such file or directory

logs that clutter the output of my searches. Is there any way to mute these gzip logs?

migrated from stackoverflow.com Nov 1 '16 at 20:21

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

You can redirect the command standard error output to the null device.

find . ! -iname "*test*" -o -iname "*foo*" | xargs zgrep -ie first.*last -e last.*first 2>/dev/null 

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.