I have two CSV files. 1.csv
files has 718 entries and 2.csv
has 68000 entries.
#cat 1.csv
#Num #Name
1 BoB
2 Jack
3 John
4 Hawk
5 Scot
...........
#cat 2.csv
#Num #Name
1 BoB
2 John
3 Linda
4 Hawk
5 Scot
........
I knew how to compare two files,when only one column(Names
) is available in both and to get the matching names
.
#comm -12 <(sort 1.csv) <(sort 2.csv)
Now i would like to check, If Num
in 1.csv
is matching with Num
in 2.csv
, What is the associated "Names" from both the csv
files for that matched Num
?
Result :
1,Bob,Bob
2,Jack,John
3,John,Linda
4,Hawk,Hawk
5,Scot,Scot
..........
How to do achieve this using comm
?