![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to extract date with time from file | prash_b | Shell Programming and Scripting | 5 | 06-18-2008 05:30 AM |
| Extract words before and after a pattern/regexp | manthasirisha | Shell Programming and Scripting | 3 | 03-21-2008 03:38 AM |
| extract words with even numbr of letters | manish205 | Shell Programming and Scripting | 3 | 02-19-2008 03:18 AM |
| Extract TIME | ndoggy020 | UNIX for Dummies Questions & Answers | 4 | 05-08-2007 05:06 PM |
| How to grep for two or more words in a line at the same time? | ElCaito | Shell Programming and Scripting | 2 | 03-01-2006 07:48 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
How to extract two words at the same time.
Hi, Can anyone please let me know, how to extract two lines at the same time. In specific,I have a file containing list of devices, such as router1 and switch2 below. I want to get all the lines which has "#" and all the lines which has "down"
router1#sh ip int br Interface IP-Address OK? Method Status Protocol^M Vlan1 unassigned YES NVRAM up down ^M Vlan100 10.71.12.202 YES NVRAM up up ^M FastEthernet0/1 unassigned YES unset down down ^M GigabitEthernet0/1 unassigned YES unset up up ^M GigabitEthernet0/2 unassigned YES unset up up ^M router1# router1#exit switch2#^M switch2#term length 0^M switch2#sh ip int br^M Interface IP-Address OK? Method Status Protocol^M Vlan1 unassigned YES NVRAM up down ^M Vlan400 10.71.12.206 YES NVRAM up up ^M GigabitEthernet0/1 unassigned YES unset up down ^M GigabitEthernet0/2 unassigned YES unset up up ^M switch2#^M I am expected to get the output as: router1#sh ip int br^M Vlan1 unassigned YES NVRAM up down ^M FastEthernet0/1 unassigned YES unset down down ^M router1# router1#exit switch2#^M switch2#term length 0^M switch2#sh ip int br^M Vlan1 unassigned YES NVRAM up down ^M GigabitEthernet0/1 unassigned YES unset up down ^M switch2#^M Regards,A Last edited by Aejaz; 04-30-2008 at 03:12 AM. |
| Forum Sponsor | ||
|
|