[CentOS] script

Chris Geldenhuis chris.gelden at iafrica.com
Wed Oct 1 05:23:52 UTC 2008


MHR wrote:
> On Tue, Sep 30, 2008 at 3:08 PM, Chris Geldenhuis
> <chris.gelden at iafrica.com> wrote:
>   
>> How about:
>>
>> find <startdir> -exec sed "s/10.5.1.10/127.128.1.10/" \{\} \;
>>
>>     
>
> First, the '\' characters are unnecessary and confusing, except the
> one that precedes the semi-colon.
>
> Second, that won't work.  Sed does not perform on files in place - its
> output is sent to stdout unless it is redirected, and you can't
> redirect it back to the original file.  To do something this way,
> you'd need a script that replaced the input file and used 'sed' to
> generate the new one (and then the script would have to rename it).
>
> mhr
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>   
Apologies I should have included the -i switch for sed to modify file in 
place.

ChrisG


More information about the CentOS mailing list