On Mon, Nov 01, 2004 at 05:19:05PM -0600, Christopher Gordon wrote: > I was having trouble using the results from grep in a for loop. I was > doing > > grep -il order *.sql | for fname ...;do vi $fname; done > > I tried various different things, and used several man pages. I > finally came up with xargs, but still couldn't quite get that to work > with my for loop. > > Any insight (whether using xargs or not) would be greatly appreciated.
1) What about: $ vi `grep -il order *.sql` Then use :wn to go to the next file after each edit. 2) Or how about: $ grep -il order *.sql > stuff $ perl -i -pe 's/^/vi /' stuff $ sh stuff $ rm stuff 3) Or maybe (this is closest to your proposed solution): $ for i in *.sql ; do > grep -qi order $i && vi $i > done 4) Or this? $ for i in `grep -il order *.sql` ; do > vi $i > done -- Don Bindner <[EMAIL PROTECTED]> ----------------------------------------------------------------- To get off this list, send email to [EMAIL PROTECTED] with Subject: unsubscribe -----------------------------------------------------------------
