How to add some text before another with sed? With GNU sed on linux I can make it like that:
sed -i "/\;Marker/i some text" conffile
It puts "some text" before ";Marker". But in FreeBSD I get an error:
sed: 1: "/conffile ...": extra characters at the end of l command
I need analog to use it in FreeBSD.
答案1
found this way:
sed -i'' -e $'/Marker/i\\\nblahblah\\\n' file
or
sed -i'' -e '/Marker/i\'$'\n''blahblah'$'\n' file