Need to shift the last VirtualHost string in a file at eof. I tried using sed
#!/bin/bash
tac infile.txt | sed "s/<\/VirtualHost>//; ta ; b ; :a ; N ; ba" | tac
echo "</VirtualHost>" >>infile.txt
Current Text:
</VirtualHost>
#Added for Patch
<LocationMatch ^/bea_wls_internal/>
RewriteEngine ON
</VirtualHost>
RewriteOptions inherit
</LocationMatch>
Desired Text:
</VirtualHost>
#Added for Patch
<LocationMatch ^/bea_wls_internal/>
RewriteEngine ON
RewriteOptions inherit
</LocationMatch>
</VirtualHost>