[PLUG] find | grep | xargs ...

Sandy Herring sandy at herring.org
Fri Mar 7 11:36:02 UTC 2003


On Fri, 07 Mar 2003, Matt Whiteley wrote: 
> On Wed, 2003-03-05 at 08:10, Randal L. Schwartz wrote:
[...]
> > find2perl . -name DS_Store -eval unlink -ls| perl
> > 
> > The -ls is just for a trace.  Leave it out to do it silent.
> > You can save the output of find2perl to reuse repeatedly.
> 
> Obviously my lack of perl knowledge is showing but I ran this command in
> a directory with files of the name 'DS_Store' and as far as I could tell
> nothing happened.  I took out the '-ls' and still could see no effect. 
> >From reading in the camel book it looked like it would work to me, is
> there something else I need to do?

Matt,

Note that the character after `ls' and before ` perl' is a pipe (vertical
bar), not the letter "l". `find2perl' generates a Perl script on stdout. You
can pipe it to perl, or redirect it to a file if you want to create the
script for future invocations. If you had the pipe correct, then the `find'
failed to find anything.

Sandy
-- 
Sandy Herring, RHCE                        o              sandy at herring.org
Peck of Pickled Pisces               __  o               http://herring.org/
UNIX or Web authoring questions?  |\/ o\  o  http://herring.org/finger.html
->http://herring.org/techie.html  |/\__/     http://herring.org/pub-key.asc
*sh, Perl, C, VBA, PICK Assembler, Data/Basic, PROC & profanity spoken here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20030307/98ad0e42/attachment.asc>


More information about the PLUG mailing list