[ale] Sed help with append
Jim Seymour
wingbarscafe at gmail.com
Tue Mar 23 11:34:32 EDT 2010
Hi,
I am trying to expand my capabilities with sed use. What I am trying
to do is modify an apache virt file as follows. The file containing
the lines to modify is named test.
<VirtualHost 12.34.567.89>
ServerAdmin webmaster at domain.com
ServerName domain.com
DocumentRoot /does/not/matter
</VirtualHost>
It needs a ServerAlias appended after ServerName as www.domain.com
What am I missing to get the pattern match in the append?
jim at swift ~ $ sed '/ServerName \(.*\)/ a\ServerAlias www.\1' test
<VirtualHost 12.34.567.89>
ServerAdmin webmaster at domain.com
ServerName domain.com
ServerAlias www.1
DocumentRoot /does/not/matter
</VirtualHost>
Have not been able to locate anything by googling about combining an
append with a remembered pattern. I even tried combining it into an
append the line and then do a substitute on the appended line to no
avail. I have a feeling there is probably something simple I have
missed somewhere.
Thanks,
--
Jim Seymour
More information about the Ale
mailing list