I have followed instructions in this post How to insert text after a certain string in a file?
but I suspect the instructions are not valid for OSX.
I want to add some text into a source file using Bash
sed '/pattern/a some text here' ${sourceFile}
but when I run the command I get
"/pattern/a some text here": command a expects \ followed by text
edit
I have created a new file called infile with a single line
pattern
and a bash script
#!/bin/bash
sed '/pattern/a\
text to insert' infile
running the script echos "pattern" to the console but doesn't insert the text
edit
I have also tried for the bash script
#!/bin/bash
sed '/pattern/a\
add one line\
\\and one more' infile
and the terminal echos
pattern
add one line
\and one more
but infile still has single line
pattern
sed, including the OSX one) is in my post there...awk '1;/pattern/{ print "add one line"; print "\\and one more"}' infile