I am follow the example of using sed to insert lines into a file at a specific pattern-match location. I have run the example from that question on my machine and it works perfectly.
So, for me, specifically, I am trying to insert the following:
<Location "someplace">
    AuthBasicProvider ldap
    AuthType Basic
    AuthName "Auth"
    AuthLDAPURL someurl
    AuthzLDAPAuthoritative on
    AuthLDAPBindDN someuser
    AuthLDAPBindPassword somepassword
</Location>
I want to insert it at the end of a .conf file (this one to be exact), specifically, immediately before the closing </VirtualHost>.
However, when I run
sed -n 'H;${x;s/\<\/VirtualHost> .*\n/test string &/;p;}' vhost.conf
to test, the contents of the file is printed but the file is not changed. Did I escape </VirtualHost> wrong or am I missing something else?
(I'm also open to other solutions for getting my content into the file.)