folding arguments
Brandon Allbery
allbery at ncoast.UUCP
Thu Feb 18 10:27:58 AEST 1988
As quoted from <2091 at bsu-cs.UUCP> by dhesi at bsu-cs.UUCP (Rahul Dhesi):
+---------------
| In article <120 at gsg.UUCP> lew at gsg.UUCP (Paul Lew) writes:
| > $ find $DIR -print | awk '{print "command",$0}' | sh (flexible)
| >or:
| > $ find $DIR -print | sed 's/^/command /' | sh (fast)
|
| Me, I prefer:
|
| $ find $DIR -exec command {} \;
+---------------
Hmmm... $ find $DIR -print | xargs command
+---------------
| in that case. In a pinch I would try something like this:
|
| $ find $DIR -print | nroff | sed -e 's/ */ /g' | ...
|
| Since nroff right-justifies by default, we use sed to squeeze multiple
| blanks to a single blank so "while read" in sh will work. (Not
| tested.)
+---------------
The shell (sh, at least) isn't fazed by multiple spaces... at least, not the
AT&T version. But if you're after efficiency, nroff is the LAST thing you
should use! ;-)
--
Brandon S. Allbery, moderator of comp.sources.misc
{well!hoptoad,uunet!hnsurg3,cbosgd,sun!mandrill}!ncoast!allbery
KABOOM!!! Worf: "I think I'm sick." LaForge: "I'm sure half the ship knows it."
More information about the Comp.unix.wizards
mailing list