Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

sed will exit gracefully with a return code of 0 even if a match is found. The sed return code by default is based on running properly not if your data matches.To determine if there was a match to your file

One of the problems I've run into, thinking I successfully modified my files even though I did not. Here, I've made a mistake of using the word coy instead of cow,

Code Block
languagebash
sed -i.bak 's/coy/reindeer/' hey.txt
cmp -s hey.txt hey.pristine.txt && echo "sed did not work, your files are identical."


Insert Multiple Lines from File with Match

...