View Single Post

  #1 (permalink)  
Old 04-09-2008, 12:34 PM
Prahlad Prahlad is offline
Junior Member
User
 
Join Date: Feb 2008
My distro: Debian
Posts: 5
Rep Power: 0
Prahlad is on a distinguished road
Default How to print some lines from a file

Hello Every one

I have a problem with me which i want to solve using shell script.

I want to display lines from my apache configuration. I want some thing like this ...

Script should display entries from <VirtualHost Ip.Ip.Ip.Ip> to sever.domain.com only
and all occurrence of domain.com should be replaced by test.com.

Like my original entry is as below.

==========
<VirtualHost Ip.Ip.Ip.Ip>
something
something
....
ServerName domain.com
ServerAlias server.domain.com
something
something
......
</VirtualHost>


O/p should be as given below.

---------
<VirtualHost Ip.Ip.Ip.Ip>
something
something
....
ServerName test.com
ServerAlias server.test.com
</VirtualHost>
--------

=========

Please guide me with this.

Thanks,
Reply With Quote