Spot an error? Know how to make this page better? I appreciate pull requests.

sed

Commandline subsitution

Find and replace a string, with a backup, because mistakes happen.

sed -i.sedbak -- 's/foo/bar/g' foobar.txt

If working with file paths, use a different separator character.

sed -i.sedbak -- 's|/home/foo/|/home/bar|g' foobar.txt