![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how can i extract text section via grep | meny | UNIX for Dummies Questions & Answers | 8 | 07-03-2009 03:58 AM |
| Perl script to search and extract using wildcards. | CammyD | Shell Programming and Scripting | 3 | 04-20-2009 03:17 PM |
| Search for string in a file and extract another string to a variable | daikeyang | Shell Programming and Scripting | 6 | 03-20-2009 08:45 PM |
| using sed to conditionally extract stanzas of a file based on a search string | aitayemi | Shell Programming and Scripting | 0 | 11-25-2008 06:16 PM |
| New Section | kapilv | Post Here to Contact Site Administrators and Moderators | 3 | 10-31-2001 09:57 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Search and extract by section from configuration
Hi,
I understand either AWK or SED can do this, but I not sure how to extract the following configuration in section. Meaning when I need to find code with " ip helper-address 192.168.11.2" , it would start from "interface Serial0/0" and "interface FastEthernet0/1". Only displaying both section by chunk. If anyone can point me in the right direction , it would be great. Thanks. Sample configuration =========================================== ! interface FastEthernet0/0 description R2 Fa0/0 ip address 192.168.1.1 255.255.255.0 duplex auto speed auto ! interface Serial0/0 description R2 Se0/0 bandwidth 2000 ip address 192.168.11.1 255.255.255.0 ip helper-address 192.168.11.2 encapsulation ppp ! interface FastEthernet0/1 description LAN interface ip address 10.1.1.1 255.255.255.0 ip helper-address 192.168.11.2 duplex auto speed 10 ! interface Serial0/1 no ip address shutdown ! router eigrp 1 network 10.1.1.0 0.0.0.255 network 192.168.1.0 network 192.168.11.0 no auto-summary ! =========================================== Expected results : =========================================== interface Serial0/0 description R2 Se0/0 bandwidth 2000 ip address 192.168.11.1 255.255.255.0 ip helper-address 192.168.11.2 encapsulation ppp ! interface FastEthernet0/1 description LAN interface ip address 10.1.1.1 255.255.255.0 ip helper-address 192.168.11.2 duplex auto speed 10 ! |
![]() |
| Bookmarks |
| Tags |
| awk, sed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|