Working –in-place “sed” option under WindowsBy neokrates, written on November 21, 2010
cmd bat snippet
For long time
gnu sed port had this error, or issue, if you will.
(-i) option was not working. Now it does.
You will need this modified
sed (it is called ‘ssed’):
-i works now:
ssed -i.backup -e "s/REPLACE_ME/REPLACED YOU/" input.txt
@echo Before: @more input.txt @ssed -i.backup -e "s/__REPLACE_ME__/REPLACED YOU/" input.txt @echo After: @more input.txt @del input.backup
I couldn’t get
ssed not to create the
input.backup file. So I add an extra line to delete it:
Backup file must be removed, or you might get: ssed: cannot rename input.txt: File exists second time you try the same
I used ssed 3.62.