cancel
Showing results for 
Search instead for 
Did you mean: 

sed question

eugene_6
Advisor

sed question

hello

i'd like to do this..
if there's an matching pattern(ff)
sed insert new line before the pattern and append the left over..

i remember there is a hold space concept in sed, so that we can store patterns and call them.. but i forgot how to do it..
--;

thx..

original file
--------------
aaaffgg
ddddd
---------------

-->
modified file(when ff is the pattern)
---------------
aaa
ffgg
dddddd
---------------
2 REPLIES
Eric Ladner
Trusted Contributor

Re: sed question

sed -e 's/ff/ff/' < yourfile > newfile

Note.. no space after the backslash and enter exaclty as above.
Eric Ladner
Trusted Contributor

Re: sed question

Hmm.. this reply got munged by the system it seems.

It should be like this:

sed -e 's/ff/BACKSLASH
ff/' < oldfile > newfile

Substitue the actual backslash character for the word backslash and make sure there is not a space after it.