I'm writing a few commands into some documentation that I'm writing on how I am configuring NGINX. Instead of writing 'open this using vi" and expecting someone to know all of that, I just want to say run this sed command.
This is my first time with sed.
The file contains an entry
server {
{{{{{{OTHER STUFF}}}}}}}
root /var/www/html;
{{{{{{MORE STUFF}}}}}}
}
I want to replace it with /var/www
and remove the html
.
I'm struggling with the slashes and nesting. There are other instances of the word "root" in the file.
This doesn't work
sed -i 's//var/www/html//var/www/g' default
s
specifies the delimiter. It can be any character. I used#
. – Kusalananda Sep 15 '17 at 17:33sed 's#root /var/www/stuff#root /var/www#' myfile
it just prints the file out to shell. – CarComp Sep 15 '17 at 17:35