Insert File Contents One Line Before Match While Escaping Backslash
问题 I recently asked a similar question How To Insert File Contents After Line Match While Escaping Backslash only to realize I need to do the opposite. Using the code from that question, I have tried: sed '/<\\tag>/i file2' file1 2nd attempt: awk '/<\\tag>/{print;system("cat File2.txt");before} 1' File1.txt However, I'm unable to get it to insert one line before the match. Example: File1.txt Hello <[World!]> 1 Hello <[World!]> 2 File2.txt: <thanks> <tag> <example> <new> <\new> <\example> <\tag>