Cygwin: during sed operation changes are not save

1

While I'm using sed I'm able to see correct results in terminal but in file changes are not visible.

  1. I used following comand:

    sed -e 's/MN2/MN9/g' 01_valid.txt
    
  2. on terminal screen I see changes in all lines,

  3. but when I execute:

    cat 01_valid.txt
    
  4. All changes are gone.

    Operation passes without any errors. Any suggestions?

Ray

Posted 2015-04-02T18:34:49.583

Reputation: 11

Answers

1

to save changes in the file, you need -i in insert the changes, other wise it will only change them in stdout

Here is a tutorial to help http://www.grymoire.com/Unix/Sed.html#uh-62h

try sed -i -e 's/MN2/MN9/g' 01_valid.txt

grag42

Posted 2015-04-02T18:34:49.583

Reputation: 409