Merge two text files at a specific location, sed or awk.

Posted by S1syphus on Stack Overflow See other posts from Stack Overflow or by S1syphus
Published on 2010-04-19T13:27:55Z Indexed on 2010/04/19 13:33 UTC
Read the original article Hit count: 235

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about sed

Related posts about awk