I'm trying to do a find/replace and an insert with sed but I keep getting a message that says "extra characters at the end of n command." I'm also not running this from the terminal, it's embedded in a shell script so I can send it to others.
This is what I'm trying to run
sed -i 's/include "/var/run/racoon/*.conf" ;/# include "/var/run/racoon/*.conf" ;/g' ~/Documents/test.conf;
sed '$a; include "/etc/racoon/remote/*.conf" ;/g' ~/Documents/test.conf;
To make it easier to see, I'm trying to replace
include "/var/run/racoon/*.conf" ;
with
# include "/var/run/racoon/*.conf" ;
and then add this
include "/etc/racoon/remote/*.conf" ;
Basically, I just want to comment out the last line of a file and then insert a line after it. I'm pretty new to sed so I'm not sure if I'm going about this all wrong, any help will be appreciated!