I'm using grep -ril
to be able to see all files that contain a certain string:
[user@machine]$ grep -ril "test string"
file1.log
file2.log
file3.log
file4.log
...
I then would like to zip all of the files that have been returned by that command. Is this possible?
I've tried things such as grep -ril myPattern | zip files.zip
and grep -ril myPattern | zip > files.zip
but nothing has worked so far.
Is there a workaround to this?
Thank you.