I have two text files, I want to place a text in the middle of another, I did some research and found information about adding single strings:
I have a comment in the second text file called STUFFGOESHERE, so I tried:
sed '/^STUFFGOESHERE/a file1.txt' file2.txt
sed: 1: “/^STUFFGOESHERE/a long.txt”: command a expects \ followed by text
So I tried something different, trying to place the contents of the text based on a given line, but no luck.
Any ideas?
This should do it:
If you want to remove the STUFFGOESHERE line:
If you want to modify file2 in place:
(or maybe
sed -i '' -e..., I’m using GNU sed 4.1.5.)