From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: f8c9b,a0766b75e5b4bd5a X-Google-Attributes: gidf8c9b,public X-Google-Thread: fee84,a0766b75e5b4bd5a X-Google-Attributes: gidfee84,public From: peter@nmti.com (Peter da Silva) Subject: Re: using find command to select files to backup Date: 2000/07/19 Message-ID: <8l46l0$htq@web.nmti.com>#1/1 X-Deja-AN: 648174340 References: <8l3rme$prp$1@power25t.hkbu.edu.hk> Organization: Engineering Netwrk Support, ABBNM Newsgroups: comp.unix.questions,comp.unix.osf.osf1 In article <8l3rme$prp$1@power25t.hkbu.edu.hk>, Pui Ming WONG wrote: > I would like to backup files whose name meeting certain criteria > onto 1 tar file from the /var/spool/mail > directory using the piping feature in unix command. > I've tried commands like: > cd /var/spool/mail > find . -name "[a-z][0-9]*" -print | tar cvf /somedir/somefile.tar - > find . -name "[a-z][0-9]*" | tar cvf /somedir/somefile.tar - > But they didn't seem to work > What should be the command be ? > The OS is DG Unix 4.0E If you do a "man tar" on Tru64 UNIX 4.0E, you get this snippet: R [Compaq] The named file immediately following this option contains a list of file names separated by newlines. This list is added to (c function key, r function key) or extracted from (x function key) the archive. The -R option is incompatible with the -C option. Try "tar -c -v -f /somedir/somefile.tar -R -". I don't know if -R accepts stdin like that, if not you can use multiple steps: find . -name "[a-z][0-9]*" > /tmp/fn$$ && tar -c -v -f /somedir/somefile.tar -R /tmp/fn$$ && rm -f /tmp/fn$$ (sh, in csh you need to add \ after the &&) -- In hoc signo hack, Peter da Silva `-_-' Ar rug t� barr�g ar do mhact�re inniu? 'U` "Hint for long-term survival: be tasty, and farmable." -- Tanuki "And that's the real message of 'The Matrix'." -- Abigail