I want to search a directory's contents for a certain string on Ubuntu, and output all files that contain it.
Problem: if zgrep tries to read a damaged file, the process stops:
zgrep -n 'test' /var/log/tomcat/archive/*
Result:
gzip: /var/log/tomcat/archive/my.log.gz: unexpected end of file
Question: how can I tell zgrep to ignore files that give errors?
gzip’szgrepandzutils’zgrepcontinue with the subsequent files.