From IT Mission Linux Tips, Hacks, Tutorials, Howtos - Itmission.org

Main: Sed-stream-editor


$ sed -i 's/123/222/' p
sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName
$ sed -e '/^ *$/d' p
33
33
33

Regular expression metacharacters:

    *The caret (^) matches the beginning of the line.
    *The dollar sign ($) matches the end of the line.
    *The asterisk (*) matches zero or more occurrences of the previous character.
sed '/yourword/d' yourfile
sed 's/yourword//g' yourfile
sed -e 's/firstword//g' -e 's/secondword//g' yourfile

or

sed  's/firstword//g;s/secondword//g' yourfile


Retrieved from http://www.itmission.org/Main/Sed-stream-editor
Page last modified on August 24, 2012, at 02:41 PM