folding arguments

Paul Lew lew at gsg.UUCP
Fri Feb 12 13:23:19 AEST 1988


>    $ command `find $DIR -print`
>    
>    which bombs out when I find too many files.  I've written a little program
>    that lets me do
>    
>    $ find $DIR -print | fa | while read x; do command $x; done

I used the following frequently:

     $ find $DIR -print | awk '{print "command",$0}' | sh	(flexible)
or:
     $ find $DIR -print | sed 's/^/command /' | sh		(fast)

Both are shorter than the 2nd command and it does not need program 'fa'.
It also works from either csh or Bourne shell, i.e., you can do this on all
types of Unix.  You can also put shell options at end, e.g., sh -x, to echo
every command as it executes, or sh -vn to test it first before you delete
the wrong files ;-(

Anyone has a even shorter solution?
-- 
Paul Lew			{oliveb,harvard,decvax}!gsg!lew	(UUCP)
General Systems Group, 5 Manor Parkway, Salem, NH 03079	(603) 893-1000



More information about the Comp.unix.wizards mailing list