I want to append something at the end of a certain line(have some given character). For example, the text is:
Line1: I just want to make clear of the problem
Line2: Thanks to all who look into my problem
Line3: How to solve the problem?
Line4: Thanks to all.
Then I want to add "Please help me" at the end of
Line2: Thanks to all who look into my problem
And "Line2"
is the key word. (that is I have to append something by grep this line by key word).
So the text after the script should be:
Line1: I just want to make clear of the problem
Line2: Thanks to all who look into my problem Please help me
Line3: How to solve the problem?
Line4: Thanks to all.
I know sed
can append something to certain line but, if I use sed '/Line2/a\Please help me'
, it will insert a new line after the line. That is not what I want. I want it to append to the current line.
Could anybody help me with this?
Thanks a lot!