|
|||||||
| 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
|
|||
|
|||
|
How to fetch files right below based on some matching criteria?
I have a requirement where in i need to select records right below the search criteria Code:
qwertykeyboard white 10 20 30 30 40 50 60 70 80 qwertykeyboard black 40 50 60 70 90 100 qwertykeyboard and white are headers separated by a tab. when i execute my script..i would be searching to bring whatever records are beneath white and black...Also, can i get these records into 2 files 1 for white and 1 for black ---------- Post updated at 10:27 PM ---------- Previous update was at 09:18 PM ---------- Any answers?????? ---------- Post updated 06-28-12 at 12:48 PM ---------- Previous update was 06-27-12 at 10:27 PM ---------- Have i posted the Question in the correct forum???? Last edited by vbe; 06-27-2012 at 11:50 AM.. Reason: mot all the text in code tags!! it becomes useless! |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Can you post desired output for that sample data?
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Sure I want file 1 ie white.txt to have Code:
10 20 30 30 40 50 60 70 80 and file 2 ie black.txt to have Code:
40 50 60 70 90 100 Last edited by Scrutinizer; 06-28-2012 at 03:24 AM.. Reason: code tags |
|
#4
|
|||
|
|||
|
Code:
sed -n '/qwertykeyboard white/,/qwertykeyboard black/p' < inputfile | sed '1d'| sed '$d' > file1 sed '/qwertykeyboard white/,/qwertykeyboard black/d' < inputfile > file2 let me know if you face any issue |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Awesome..Thanx a lot!!
|
| 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 |
| How to select files based on a criteria? | saggiboy10 | UNIX for Dummies Questions & Answers | 7 | 06-20-2012 10:46 AM |
| Archive files to different target folders based on criteria | kmsekhar | Shell Programming and Scripting | 2 | 08-30-2011 06:18 AM |
| Script move and rename based on matching criteria | braidomik | Shell Programming and Scripting | 3 | 08-26-2008 11:35 AM |
| Simultaneous searching for files (names matching certain criteria) in several directo | Hopeful | AIX | 0 | 02-13-2008 01:31 PM |
| deleting files and folders matching criteria | H3001 | Shell Programming and Scripting | 4 | 06-25-2007 08:20 AM |
|
|