Dear god, regular expression
The first / is search, the second / is command. in this case, we don’t have command, so it replace. (misinfo alert)
sed '/search/replaced/g' file-i edit the file directly without printing to stdout first. I prefer avoid using this, better debug
sed -i '/search/replaced/g' filea command insert our text after printing the search string. Meaning it will search our search text, then print our inserted text the line below
sed '/search/a inserted' filei command insert our text before printing the search string
sed '/search/i inserted' filer insert content of another file after printing the search string
sed '/search/r insert.txt' filee insert a command output before printing the search string
sed '/search/e cat insert.txt' file