shell script search and replace if not found write code example Example: replace using sed #on my mac sed -i -e 's/old-text/new-text/g' text.txt