'ello Graeme
On Tue, Jul 30, 2002 at 09:16:15AM +0100, Graeme Fowler wrote:
> On Tue, 30 Jul 2002, Paul Sladen wrote:
> [snip brief 'find' explanation]
> > The `xargs' program takes the contents of stdin (data `piped' to it) and put
> > them on the command line, eg:
> [snip]
> > $ find ./ -name '*.o' | xargs rm
> Or you could just make use of the -exec switch to find, which allows
> clever things like:
> [root]# find /usr/src/widget/ -name \*.c -exec rm -f {} \; -name \*.o
> -exec mv {} /usr/src/widget-objects/
But which for simple cases runs one rm per file instead of one per lots
of files (ARG_MAX - 2k or 20k according to my info pages)
> ...and (this may vary from distro to distro) Paul missed the "-i" and "{}"
> from xargs, too:
Hmm, does yours need that then? Strange.
Whilst we're on the subject of find and xargs the most useful flags to
each are to add -print0 to your find and -0 to your xargs so that
filenames with spaces or bizarre characters can be treated.
-- Simon [ huggie@earth.li ] *\ '* blitz a un super bout de lisp qui \** ****** ]-+-+-+-+-+-+-+-+-[ **\ fake les headers Mutt' #parinux de \* ****** [ Htag.pl 0.0.22 ] ***\ Mlle Muttfr.org \ -------------------------------------------------------------------- http://www.lug.org.uk http://www.linuxportal.co.uk http://www.linuxjob.co.uk http://www.linuxshop.co.uk --------------------------------------------------------------------
This archive was generated by hypermail 2.1.3 : Tue 30 Jul 2002 - 18:40:56 BST