Results 1 to 3 of 3
For example if i have the following "OneThree" and i want to add the word "Two" between "one" and "three". To have "OneTwoThree" How can i do this?...
- 03-03-2011 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 11
Using sed, How can I add text between two words?
For example if i have the following "OneThree" and i want to add the word "Two" between "one" and "three". To have "OneTwoThree" How can i do this?
- 03-03-2011 #2
I would replace the words completely. i.e. replace "OneTwo" with "OneTwoThree". One could also replace "One" with "OneTwo" or "Three" with "TwoThree". But these things depend on the overall context.
- 03-03-2011 #3
as Kloschüssel said, it depends on context.
One way of accomplishing this might be:
Code:sed 's;\(^One\)\(Three\)$;\1Two\2;' YOUR_FILE
You must always face the curtain with a bow.


Reply With Quote