![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Shell Script Required? Pls. help me | ntgobinath | Shell Programming and Scripting | 22 | 05-29-2008 07:09 AM |
| Shell Script Required! | vats | Shell Programming and Scripting | 3 | 08-28-2007 02:29 AM |
| shell script required | sethunath | Linux | 1 | 07-07-2007 05:04 AM |
| shell script required | sethunath | Shell Programming and Scripting | 4 | 07-06-2007 03:39 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
I have following information in one file.
ObjID: 004ee4e4-0d92-71dd-1512-9887a1f10000 Address: 152.135.0.61 PingState: Ping Responding ----------------Management Address--------------------- ++++++++++++++++Interface+++++++++++++++++++++ IFName: dall00r1.mis.amat.com[ 0 [ 2 ] ] ObjID: 0155c646-0d92-71dd-1512-9887a1f10000 IFAlias: - IFDescription: GigabitEthernet0/0 Status: Normal IfIndex: 2 IfType: 6 AggregatedInterfaceObjID: - Capability: isL2Connected isCDP ----------------Interface--------------------- ++++++++++++++++Interface+++++++++++++++++++++ IFName: dall00r1.mis.amat.com[ 0 [ 1 ] ] ObjID: 0bb25a50-0d92-71dd-1512-9887a1f10000 IFAlias: Dest:AT&T MPLS CLOUD Type: ISP T1 CID: IFDescription: Serial0/1/0 Status: Normal IfIndex: 1 IfType: 23 AggregatedInterfaceObjID: - Capability: isCDP isMulticast ++++++++++++++++Address+++++++++++++++++++++ Requirement: Now, Whenever it's matches '++++++++++++++++Interface+++++++++++++++++++++' then it should print next 5 lines in the output file. Pls. anybody gives script for this requirement. I'm new to scripting. Pls. help me out. Thanks, Gobinathan.S |
|
||||
|
hello try this one out,
hope this helps you please paste this in a file and make it shell executable by chmod 755 and run it. awk ' $0 ~ /\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+Interface\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+/ { match_str="YES"; line_cnt=0; next; } { if((line_cnt < 5) && ( match_str=="YES")) { print $0; line_cnt += 1; } else { match_str="NO"; line_cnt=0; } }' inputfile_name |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|