I have file1 which has 3 columns and file2 which has 8 columns. What I wanted to do was if the first 3 columns in file 2 were found in file 1, then print out the entire 8 columns in file 2.
I have tried codes like
awk 'NR==FNR{c[$1$2$3]++;next};c[$1$2$3]>0' file1 file2
...but it only printed out the last matching line in file2.
I have no idea what was wrong. Could anyone help me out? I'd really appreciate it! Thank you in advance!
file1 looks like this
7000000185249020 89812 89911
7000000185249020 89912 90011
7000000185249020 202532 202631
7000000185249020 202632 202704
7000000185249020 202764 202863
.....
file2 looks like this
7000000185249020 89812 89911 100 14.1 20 0.511 48
7000000185249020 89912 90011 100 12.7 19.8 0.642 49
7000000185249020 90012 90023 12 11 17.9 0.704 58.3
paste
to merge them and then check for$1==$5 && $2 == $6 [etc]
.next
skips the rest of theawk
script for the purposes of the current record.