🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1391

Re: Can U pipe filenames to rm???

#1391
From: Matthew Farwell
Date: Fri, 05 Oct 1990 16:30
33 lines
1821 bytes
In article <941@hls0.hls.oz> george@hls0.hls.oz (George Turczynski) writes:
>From previous postings-
>
>> >Example:
>> >  find {{stuff here}} -print | xargs rm -f
>  
>> Locally, we've hacked our "find" to handle:
>> 	$ find . -name \*.old -rm
>
>Our `find' (SunOS) supports the `-exec' option, and I assume this would be
>fairly common.  So, those of you without xargs, and who | a. can't,  b. don't
>want to | hack `find' use it like this:
>
>	find {{stuff here}} -exec rm -f {} \;
>
>Why use `xargs' when you don't need to ?

2 points.
1) The original posting wasn't about find, it was about another pipe which
produced filenames on stdout, so comments on xargs were required.

2) find / -exec rm -f {} \; spawns rm everytime it encounters a file
so its very slow and expensive, whereas xargs collects all the filenames
together, bundles them up into lines which won't exceed the system limit
and then spawns one job for all of those. Its much more environmentally
friendly.

Dylan.
-- 
Matthew J Farwell                 | Email: dylan@ibmpcug.co.uk
The IBM PC User Group, PO Box 360,|        ...!uunet!ukc!ibmpcug!dylan
Harrow HA1 4LQ England            | CONNECT - Usenet Access in the UK!!
Phone: +44 81-863-1191            | Sun? Don't they make coffee machines?
Technical Details
Message-ID: <1990Oct5.163050.8835@ibmpcug.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!slxsys!ibmpcug!dylan
References: <28790001@col.hp.com> <1977@sixhub.UUCP> <1990Sep30.182331.14363@iconsys.uucp> <941@hls0.hls.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!slxsys!ibmpcug!dylan
From: dylan@ibmpcug.co.uk (Matthew Farwell)
Newsgroups: comp.unix.shell
Subject: Re: Can U pipe filenames to rm???
Message-ID: <1990Oct5.163050.8835@ibmpcug.co.uk>
Date: 5 Oct 90 16:30:50 GMT
References: <28790001@col.hp.com> <1977@sixhub.UUCP> <1990Sep30.182331.14363@iconsys.uucp> <941@hls0.hls.oz>
Reply-To: dylan@ibmpcug.CO.UK (Matthew Farwell)
Organization: The IBM PC User Group, UK.
Lines: 33