This is a discussion on How to print some lines from a file within the Shell scripting forums, part of the Development/Scripting category; Hello Every one I have a problem with me which i want to solve using shell script. I want to ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
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, |
| Sponsored Links | ||
|
|
|
||||
|
I'm not sure what exactly you want but patterns (text beween two words or pattern) can be selected using sed:
Code:
sed -n '/WORD1/,/WORD2/p' httpd.conf sed -n '/<VirtualHost*/,/<\/VirtualHost>/p' httpd.conf
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to make leafpad to print | satimis | Linux software | 0 | 12-25-2007 07:36 PM |
| Script to display number of lines and words from a file | newbewie | Shell scripting | 2 | 12-07-2007 10:37 PM |
| Load balancing pooling print jobs using CUPS print queues | raj | Getting started tutorials | 0 | 01-16-2007 09:08 PM |
| print data to txt | rock | Shell scripting | 1 | 03-10-2006 02:01 AM |
| Calculations across different lines & columns of a file | Guest | Shell scripting | 2 | 09-16-2005 04:18 AM |