[Sig] Re: [Lvlug] How to run SED

Randy Kramer rhkramer@fast.net
Fri, 23 Feb 2001 07:38:53 -0500


Linc,

Thanks!  The missing asterisk was the key -- it should have been:

for f in *,v; ...

The $f was required (in "$f > x") -- I'nm not exactly sure why, but with
that, the sed command created a new copy of each file, replacing
"nobody" with "apache".  The "mv x $f" then replaced the original file
with the copy which was exactly what was needed.

It then ran as all one line entered at the command line.  

I'm going to experiment with eliminating white space so it fits all on
one line, and also as a #!/bin/bash file -- would it work on multiple
lines then?  Would I still need the ";"s?

Thanks again,
Randy

> The snippet:
> for f in ,v; do sed 's/nobody\:/apache\:/' $f > x; mv x $f; done

Should be:
for f in *,v; do sed 's/nobody\:/apache\:/' $f > x; mv x $f; done


LFessen106@aol.com wrote:
> 
> Yeah, fix their code...  The "for f in" part designates a file loop, but the ",v" should be a condition and not a variable..  Something like "for f in *.txt" would look at all *.txt files in the current directory.