Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.unix.wizards Subject: Re: folding arguments Summary: doing it efficiently is harder Message-ID: <2091@bsu-cs.UUCP> Date: 12 Feb 88 15:14:46 GMT References: <3822@megaron.arizona.edu> <120@gsg.UUCP> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 22 In article <120@gsg.UUCP> lew@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 {} \; However, the original poster wanted to give the command as many arguments as possible, so it would be invoked less often, presumably because efficiency was important to him. Something like the original fa, which folds argument lists into manageable size, is essential 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.) -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi