The is a test file created by nixCrft for demo purpose.
foo is good.
Foo is nice.
I love FOO.
sed 's/foo/bar/g' hello.txt
OUTPUT:
The is a test file created by nixCrft for demo purpose.
bar is good.
Foo is nice.
I love FOO.
To match all cases of foo (foo, FOO, Foo, FoO) add I (capitalized I) option as follows:
sed -i 's/foo/bar/gI' hello.txt
OUTPUT:
The is a test file created by nixCrft for demo purpose.
bar is good.
bar is nice.
I love bar.