![]() |
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 |
| Splitting a file based on the records in another file | er_ashu | Shell Programming and Scripting | 2 | 05-12-2008 04:34 PM |
| Report running processes in a specific format (tricky column filtering) | goldfish | Shell Programming and Scripting | 6 | 02-14-2008 08:22 PM |
| (cont) Retrieve line from a file based on a value in specific column | efernandes | UNIX for Dummies Questions & Answers | 0 | 01-27-2007 01:00 PM |
| Retrieve line from a file based on a value in specific column | efernandes | UNIX for Dummies Questions & Answers | 1 | 01-27-2007 11:04 AM |
| Select records based on search criteria on first column | shashi_kiran_v | UNIX for Dummies Questions & Answers | 2 | 12-02-2005 01:49 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Filtering records of a file based on a value of a column
Hi all,
I would like to extract records of a file based on a condition. The file contains 47 fields, and I would like to extract only those records that match a certain value in one of the columns, e.g. COL1 COL2 COL3 ............... COL47 1 XX 45 N 2 YY 34 y 3 ZZ 44 N 4 XX 89 Y 5 XX 45 N 6 YY 84 D 7 ZZ 22 S From this file, I would like to extract all records whose COL2=XX or YY, and all other records will be excluded (as shown below). COL1 COL2 COL3 ............... COL47 1 XX 45 N 2 YY 34 y 4 XX 89 Y 5 XX 45 N 6 YY 84 D Does anybody know how to do this using sed or awk or any other UNIX tool? Thank you. |
| Bookmarks |
| Tags |
| awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|