unix - sed edit file in-place - Stack Overflow Syntax is similar to sed, but certainly not exactly the same Even if you don't have a -i supporting sed, you can easily write a script to do the work for you Instead of sed -i 's foo bar g' file, you could do inline file sed 's foo bar g' Such a script is trivial to write For example:
unix - What does sed -i option do? - Stack Overflow sed 's "p" 0 g' file txt > file txt Unfortunately because of the nature of redirects the above will simply produce a blank file Instead a temp file must be created for the output which later overwrites the original file something like this:
What is the purpose of -e in sed command? - Unix Linux Stack Exchange In your example sed 's foo bar ' and sed -e 's foo bar ' are equivalent In both cases s foo bar is the script that is executed by sed The second option is more explicit, but that is probably not the reason that you often see -e used The reason for that is that -e makes it possible to use more than one script with the same invocation of sed
How to use variables in a command in sed? - Stack Overflow @tripleee While I'm certain that this would be a duplicate of numerous other questions, the one that you've pointed to isn't the best one since it doesn't contain slashes in the variable