Tag Archive for 'replace'

Sed replace text


I show you in this little example how to replace quickly text using sed:



1
2
cat examples.conf 
foo+bar=foo


1
sed -i 's/foo/foo_bar/g' examples.conf

foo in file examples.conf will be replaced with foo_bar
After replacement:

1
foo_bar+bar=foo_bar

Dry run without changes:

1
sed 's/192.168.0.1/nameserver.local/g' $domain