help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] unmatched


From: Val Krem
Subject: [Help-bash] unmatched
Date: Sat, 3 Sep 2016 22:57:01 +0000 (UTC)

Hi  all,

I have two files file1 and file2.

file1
4
5

File2
ID  y1  y2 y3 

125 4       0   465
126 4 2001   12
127 4 2002   40
128 4 2016   1
135 5       0   465
136 5 2001   12
137 5 2002   40
138 6 2016   1
139 6 2017 2


My aim to match the two files  (file1 and file2) and list the unmatched  lines 
from file 2.

I matching file1(has only one field) with field 2 (Y1) of file2  and to get the 
output that do not match.
here 

file 3 

138 6 2016 1
139 6 2017 2


I used the following to get the matching lines between the two files


awk  'NR==FNR{c[$1]++;next};c[$2] >0' file1 file2


Is it possible to get the negative of this teh above line? i.e., to get the 
unmatched lines


Thank you in advance


reply via email to

[Prev in Thread] Current Thread [Next in Thread]