![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| struggling within awk | geeko | Shell Programming and Scripting | 4 | 10-09-2007 03:14 AM |
| Help- Unix File Compare- Struggling | guiguy | UNIX for Advanced & Expert Users | 2 | 01-06-2007 08:32 PM |
| Struggling with a text file | pau | Shell Programming and Scripting | 13 | 05-03-2006 10:47 AM |
| Struggling with mkfifo | alan | UNIX for Dummies Questions & Answers | 20 | 04-20-2004 10:10 PM |
| struggling with addusr ... | Dufty | UNIX for Dummies Questions & Answers | 2 | 01-22-2002 05:00 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Struggling with AWK
I know this is an easy problem, but I've been struggling with it all morning and finally admit I need help.
I have two files that I need to compare. After doing this the easy way (grep -F) I realize that there are other fields in file2 that match field1 in file1, so I turned to awk. I want to compare the first field in each, and if field1 of file1 matches field1 of file2, print out the entire line in file2. I've been trying to write an awk script but just don't fully understand how to do this. I get as far as: Code:
awk '
FS="\t";
BEGIN {
while (getline <"file1.txt"){
$fieldq==$1;
Last edited by Franklin52; 10-22-2009 at 11:04 AM.. Reason: Please use code tags! |
| Bookmarks |
| Tags |
| awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|