I’m trying to insert a line of text which is;
include /etc/nginx/sites-enabled/*;
On the next line after the words;
for more information.
in my /etc/nginx/nginx.conf using the following command
sudo sed '/for more information.'/a include /etc/nginx/sites-enabled/*;' /etc/nginx/nginx.conf
But each time i run it, it just returns
>
Im not very good with this sort of stuff so i was hoping someone could help me out.
Cheers,
Advertisement
Answer
Remove the second single-quote. It is superfluous:
sudo sed '/for more information./a include /etc/nginx/sites-enabled/*;' /etc/nginx/nginx.conf
Also, Because .
matches any character and you probably want it to match only a period, escape it like this:
sudo sed '/for more information./a include /etc/nginx/sites-enabled/*;' /etc/nginx/nginx.conf
Or this:
sudo sed '/for more information[.]/a include /etc/nginx/sites-enabled/*;' /etc/nginx/nginx.conf