So, I have a bunch of files in a directory, and I need to insert a line of text into each of them. They have essentially the following format:
<VirtualHost *:80>
ServerAdmin gabe@localhost
DocumentRoot /var/www/test1
ServerName test1.local
ServerAlias test1
<Directory "/var/www/test1">
Options All
AllowOverride All
</Directory>
</VirtualHost>
And I'd like to insert a line before the closing
</VirtualHost>tag. My first assumption is that I should be able to do this with sed, probably matching and replacing that tag. I'm going to start attempting this now, but if anyone has a existing way to do this, I'd love to hear it.