If you'd like to subscribe for more updates use the [RSS feed](https://www.singhkays.com/index.xml) or follow me on Twitter [@singhkays](https://twitter.com/singhkays)

Fixing "sed: command i expects \ followed by text" error

I ran into a very weird error today. While trying to automate the deployment for this blog, I needed to replace a string in a file. The internet tutorials [1, 2, 3, 4] told me that sed would be perfect for this job and the following command should work: sed -i 's/search_string/replace_string/' filename The Error However, I kept getting tripped up by the following error: sed: 1: "i2.html": command i expects \ followed by text I spent a bunch of time trying to make sure I escaped the right characters in my strings but the error was persistent!...

December 10, 2020 · 2 min · Kay Singh