![]() |
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 |
| select vs poll | smanu | IP Networking | 12 | 04-30-2007 05:22 PM |
| reappearing menu list using select | forever_49ers | Shell Programming and Scripting | 9 | 09-13-2006 04:05 PM |
| how to generate a random list from a given list | mskcc | Shell Programming and Scripting | 3 | 05-30-2006 03:30 AM |
| Comparing a distinct value in 1 list with another list | manualvin | Shell Programming and Scripting | 6 | 06-22-2004 06:42 AM |
| select() and read() | jnuno | High Level Programming | 2 | 11-19-2002 02:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
Awk - select from a list
Hi all,
I am trying to select some columns from a file, based on the list of values. Would like to know how best I can achive this. If coulmn 1 has a value of 57 then print the ist column (This works) Code:
awk -F' ' '{if ( $1 == 57 ) {print $1}}' file.txt
Code:
awk -F' ' '{if ( $1 == 57 || $1 == 58) {print $1}}' file.txt
(I could put the 100 values into a file if that makes things easier) Please let me know if you need more information. Any help greatly appreciated. |
|
||||
|
vgersh99,
Pardon my ignorance - Just a little clarification needed here. numList and numberList mismatch is a typo or it needs to be that way? Also how do I check for a particular coulmn in the myFile (for example the 14th coulmn). The delimiter is tab in myFile. Thanks for your time. |
|
|||||
|
Quote:
Quote:
Code:
$1 in numList {print $1}
Code:
$14 in numList {print $14}
|
|
||||
|
Not sure what I am doing wrong, but I am not getting any results when i run the command
Code:
nawk -f simha.awk numberList myFile myFile is my tab delimited file whose 14th colunm needs to be compared to the values in the numberList file. simha.awk has the exact code you have specified (The one with 14) Appreciate your help so far. ![]() |
| Sponsored Links | ||
|
|