following older posts (How do I use vim on the command line to add text to the middle of a file? & How to insert the content of a file into another file before a pattern (marker)?), I have a more complex case which I need your advice. I have the following Test.conf file:
server {
listen 80;
server_name jenkins2;
location /DE06/ {
proxy_pass http://jenkins2:18015/DE06/;
}
}
I want to run one command, so in the end, the file content will be:
server {
listen 80;
server_name jenkins2;
location /DE15/ {
proxy_pass http://jenkins2:18015/DE15/;
}
location /DE06/ {
proxy_pass http://jenkins2:52716/DE06/;
}
}
means I need to find the first occurrence of the word jenkins2, and then add this content:
location /DE15/ {
proxy_pass http://jenkins2:18015/DE15/;
}
any idea what is the right command?