[[Sig] How to run SED]
Fri, 23 Feb 2001 07:48:28 -0500
Thanks! The explanation in your answer is very helpful!
Randy KramerPaul F.Ryan wrote:
> Your snippet of code is attempting to change all the occurances of "nobody:"
> to "apache:" inside a bunch of files reprsented by the list ",v". I'm
> assuming this is security related since nobody is the default security
> principal in apache. Anyway, your guess at running it in a shell with
> #!/bin/shell_name was correct, except inside the shell (or at the login shell)
> you still have to present it with the list of files. You have at least two
> options. First, discover what the list of files is (probably set by a line or
> two above in the shell snippet) and then performing either of the following at
> the shell prompt:
> for f in filename1 filename2 filename3; do sed 's/nobody\:/apache\:/' $f > x;
> mv x $f; done
> sed 's/nobody\:/apache\:/' filename1 > x; mv x filename1
> sed 's/nobody\:/apache\:/' filename2 > x; mv x filename2
> sed 's/nobody\:/apache\:/' filename3 > x; mv x filename3
> There are other ways to use this "for" construct, but this will probably be
> the easiest approach for you.