How to zip a list of files in Linux
Very simple:
zip archive -@ < out.txt
That is, if your out.txt
file contains one filename per line. It will add all the files from out.txt
to one archive called archive.zip
.
The -@
option makes zip
read from STDIN.
If you want to skip creating a temporary out.txt
file, you can use grep
's capability to print filenames, too. -r
enables recursive search (might not be necessary in your case) and -l
prints only filenames:
grep -rl "abc" file-* | zip archive -@