Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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.