Hello everyone.
Suppose I have a file with the following content:
Code:
$ cat thefile
one
two
three
four
five
I want to search for the pattern that is spread across two lines and append a line after it. For example, I want to search for the patterns 'two' and 'three,' then append the line 'The new line' after that.
The output should be like this:
Code:
$ cat thefile
one
two
three
The new line
four
five
I tried this command, and it is not working.
Code:
$ sed '/two\nthree/a\The new line/' thefile
I appreciate any solution.
Thanks