|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with search criterai
Hi , I have requirement... where in there are headers in the file and i need to pick the records right below them... Example; Code:
Qwerty Apple 10 20 30' 30 40 50 50 60 70 Qwerty Mango 40 50 60 76 86 98 80 59 67 Qwerty banana 77 66 99 77 99 100 Now, my search criteria shud be based on apple,mango and banana and i need to pick the records beneath the header and the headers shouldn't be present in the file. Last edited by vbe; 06-22-2012 at 09:07 AM.. Reason: code tags |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
sed '/^Qwerty/d' file |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Code:
sed -n '/[0-9]/p' infile |
|
#4
|
||||
|
||||
|
sed '/^Qwerty/d' file ......Works fine
But what if say , i do not want the records below Qwerty Mango???? How can we handle this????
Last edited by vbe; 06-22-2012 at 09:11 AM.. Reason: icode tags |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Code:
sed '/^Qwerty Mango/q' file |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
it doesnt work as expected...get the same result as Code:
sed '/^Qwerty/d' file Last edited by vbe; 06-22-2012 at 09:43 AM.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Binary Search Tree Search problem | meredith1990 | Programming | 1 | 02-27-2012 10:23 AM |
| sed help - search/copy from one file and search/paste to another | ncwxpanther | Shell Programming and Scripting | 5 | 08-21-2011 10:56 AM |
| Search files with specfic extention and later search content | lovi_v | UNIX for Advanced & Expert Users | 2 | 07-14-2008 12:05 PM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 09:24 AM |
| Advanced Search Problems.. Search by User Name | Neo | Post Here to Contact Site Administrators and Moderators | 1 | 05-19-2003 12:28 AM |
|
|