Last updated on September 6th, 2014 at 01:00 am
You received error from the sed command in Mac, because the argument in mac is different.
If you type in Mac terminal, you may receive error like this
[code lang=”bash”]
Justins-MacBook-Pro:2 juzhax$ sed -i ‘s/old_text/new_text/g’ example.txt
sed: 1: "config.php": command c expects \ followed by text
[/code]
The first argument should be the extension of the backup file. The correct way is
[code lang=”bash”]
Justins-MacBook-Pro:2 juzhax$ sed -i ‘.bak’ ‘s/old_text/new_text/g’ example.txt
[/code]
or
[code lang=”bash”]
Justins-MacBook-Pro:2 juzhax$ sed -i ‘.original’ ‘s/old_text/new_text/g’ example.txt
[/code]
If you don’t want any backup file, you can do like this.
[code lang=”bash”]
Justins-MacBook-Pro:2 juzhax$ sed -i ” ‘s/old_text/new_text/g’ example.txt
[/code]