I am trying to insert a few lines of text before a specific line, but keep getting sed errors when I try to add a new line character. My command looks like:
On MacOs I needed a few more things.
i
-i
to specify no backup fileThis code searches for the first instance of in pom.xml and inserts another XML object immediately preceding it, separated by a newline character.
sed -i '' "/\<\/plugins/ i \\
\ \\
\ org.apache.maven.plugins \\
\ maven-source-plugin \\
\ \\
\ \\
\ attach-sources \\
\ \\
\ jar \\
\ \\
\ \\
\ \\
\ \\
" pom.xml