I've searched all over stackoverflow (perhaps I just suck at searching) but I cannot find the answer to my problem. I'm trying to insert a word or a string in between two patterns in the same line using sed.
I know how to insert a word AFTER a searched pattern using
sed -e "s/pattern/& new_word/g"
with an ampersand (&).
But this command inserts 'new_word' in every occurrence of searched pattern so I'm trying to specify it so that it inserts 'new_word' only in between two patterns.
For example,
Some words = [want to insert words here];
How do I insert it between "Some words (multiple whitespaces here) =" and ";"?
What is the syntax for this kind of command? Also, what resources do you guys use to learn sed? Many of the sed tutorials that I've searched are very basic and doesn't go into details of usage of different options and flags.
Thank you.