I\'m trying to add a line of text to the middle of a text file in a bash script. Specifically I\'m trying add a nameserver to my /etc/resolv.conf file. As it stands, resol
How about something like:
sed -e ':a;N;$!ba;s/nameserver/nameserver 127.0.0.1\nnameserver/' /etc/resolv.conf
(similar to this: sed: Find pattern over two lines, not replace after that pattern)