Working –in-place “sed” option under Windows

By neokrates, written on November 21, 2010

cmd bat   snippet

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 215 views
Rate it
Ad
Poll
  • Trend: what general purpose computer language will dominate IT industry in the next decade?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext

For long time gnu sed port had this error, or issue, if you will.
The --in-place (-i) option was not working. Now it does.

You will need this modified sed (it is called ‘ssed’):

http://sed.sourceforge.net/grabbag/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: @del input.backup.
Backup file must be removed, or you might get: ssed: cannot rename input.txt: File exists second time you try the same ssed command.
I used ssed 3.62.

Have fun!

Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
RELATED
Pages
Posts
SOCIAL
Be Sociable, Share!

Leave a Reply