I am trying to search a string in a folder "test".
This folder has sub folders and zip files too. I want to search within this directory to find the match.
I used
zgrep '11:57' test
zgrep '11:57' test
But I could not got the result.
can some one tell the exact command for it.
Best Answer
You need to specify the files you want to be checked so in this case you should use:
But you also want sub-directories. For this you need to include the
find
-command.Edit: I didn't use the
find -exec cmd {}
option here because according to this blog and this topic-exec
runs a separate instance of your command for every find. Especially with lots of files this is not efficient. One pipe toxargs
andxargs
makes sure it runs your command as few times as possible which is often just once.