Working –in-place “sed” option under Windows

By neokrates, written on November 21, 2010

cmd bat   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • What SVN client do you use?

    • Don't use SVN (93%, 14 Votes)
    • Command line (7%, 1 Votes)
    • Subversive (0%, 0 Votes)
    • Subclipse (0%, 0 Votes)
    • Idea SVN (0%, 0 Votes)
    • TortoiseSVN (0%, 0 Votes)
    • Different tool (0%, 0 Votes)

    Total Voters: 15

    Vote

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:

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!

 
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
    nope :(
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply