[ale] Sed help with append

Richard Bronosky Richard at Bronosky.com
Tue Mar 23 13:20:16 EDT 2010


Would you mind doing this in awk? It would be very easy to do with
stored variables.

On Tue, Mar 23, 2010 at 11:34 AM, Jim Seymour <wingbarscafe at gmail.com> wrote:
> 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
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>



-- 
.!# RichardBronosky #!.


More information about the Ale mailing list