1753448 Members
5764 Online
108794 Solutions
New Discussion юеВ

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 2
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.