Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using two (or more files) in awk

Status
Not open for further replies.

laurentiuz

Programmer
Oct 26, 2002
14
0
0
FR
Hi,
Can you tell me please how can I use 2 files in the same time please ?
Ex: file 1
aa axbf erd ;ascfg; 111
bghhhedk qs ;ascer; 222
as df sf ww ;g7bnz; 333

file 2

aa axbf erd ;774555
bghhhedk qs ;886690
as df sf ww ;123456
mlk fghssss ;100000

What I need is a file like :

aa axbf erd;ascfg;111;774555;OK
bghhhedk qs;ascer;222;886690;OK
as df sf ww;g7bnz;333;123456;OK
mlk fghssss;;;100000;NOK

where the first column (even if it is like "aa axbf erd" meaning composed by several groups) must be the join criteria for the 2 files and if there is no match a NOK value must be added (instead of a OK for those which are matching)
Join looks like it doesn't work for adding the status

Thank you !
PS : the bad thing is that the separator can be space

 
man join

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top