sed command to replace string in file and save code example
Example 1: sed replace in file
sed -i 's/foo/bar/g' hello.txt
Example 2: replace using sed
#on my mac
sed -i -e 's/old-text/new-text/g' text.txt
sed -i 's/foo/bar/g' hello.txt
#on my mac
sed -i -e 's/old-text/new-text/g' text.txt