On Thu, Jul 26, 2012 at 11:00 AM, Andy Bach <afb...@gmail.com> wrote: > On Thu, Jul 26, 2012 at 5:05 AM, Jack Vo <jacksvo2...@gmail.com> wrote: >> I need to compress many files in a directory on server. I use "awk" and >> "zip" command to compress these files. > > Yeah, awk's not buying you anything here. zip will take file names as > stdin so you can just pipe your ls grep to zip - see man zip > -@ file lists. If a file list is specified as -@ [Not on > MacOS], zip takes the list of input > files from standard input instead of from the command line. For > example, > > zip -@ foo > > will store the files listed one per line on stdin in foo.zip. > > Under Unix, this option can be used to powerful effect in > conjunction with the find (1) command. > For example, to archive all the C source files in the current > directory and its subdirectories: > > find . -name "*.[ch]" -print | zip source -@ > > (note that the pattern must be quoted to keep the shell from > expanding it).
-- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/