18
8
I have many files I need to zip into a single directory. I don't want to zip all the files in the directory, but only ones matching a certain query.
I did
grep abc file-* > out.txt
to make a file with all the instances of "abc" in each file. I need the files themselves. How can I tell bash to zip only those files?
Wildcards does not work? Why? If I can ask... – jherran – 2014-11-02T15:15:16.977
@jherran I don't want to zip all the files in the directory, only ones matching a certain query. I did
grep abc file-* > out.txt
to make a file with all the instances of "abc" in each file. I need the files themselves. – john mangual – 2014-11-02T15:18:49.750What @jherran means is
zip ZipFile.zip file-*
, which is the obvious way to do it. You would need an intermediate file only if you were using a complexfind
or a concatenation of file lists from different searches. – AFH – 2014-11-02T18:07:44.587