![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I want to print next 3 lines after pattern matching. | naree | Shell Programming and Scripting | 12 | 05-21-2009 03:04 AM |
| print certain pattern from 2 lines | ali560045 | Shell Programming and Scripting | 2 | 10-15-2008 08:08 AM |
| Print the line within the search pattern | manosubsulo | Shell Programming and Scripting | 3 | 10-15-2008 07:11 AM |
| awk how to print if the search pattern contains speace | McLan | Shell Programming and Scripting | 1 | 04-09-2008 09:39 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 03:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Print lines between the search pattern
hi,
I have a file say x.txt containing xxx 123 bla bla ... you xxx dfk dbf ... me xxx ... ... keeps on.. i need to search for pattern in the line starting xxx in the file. If pattern matched, I need to fetch all the lines till i find next xxx. Please help. |
|
||||
|
Quote:
Code:
awk 'p && /xxx/{exit} /xxx/{p=1}p' file
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| sed syntax, unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|