The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help choco4202002 UNIX for Advanced & Expert Users 0 08-26-2008 01:28 PM
Lookup file mohan705 Shell Programming and Scripting 4 08-05-2008 04:22 AM
Lookup on a file ukatru Shell Programming and Scripting 4 07-31-2008 01:25 AM
Lookup with a file pavan_test UNIX for Dummies Questions & Answers 5 07-21-2006 10:57 AM
file lookup gillbates UNIX for Dummies Questions & Answers 6 12-12-2003 02:04 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-27-2009
pinnacle pinnacle is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 182
Multiple file lookup using awk

I want to lookup filea with fileb,filec and filed.
If entry in filea exist in fileb and filec mark Y and then if entry in filea exist in filed mark as Y.
Final output should have all the entries from filea.

Quote:
filea:
abc
def
ghi
jkl

fileb:
abc,tt
def,kk

filec:
abc,ii
ghi,nn
filed:
ghi,aa
jkl,mm

output:
filea,fileb&c,filed
abc,Y,
def,,
ghi,,Y
jkl,,Y
This prints only matching entries from file a in fileb i want all entries from filea if it exists or not in fileb

Code:
nawk -F"|" 'NR==FNR{a[$1];next} $1 in a{print $1} filea fileb
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0