I have two csv files and im trying to compare them. e.g.
SAMPLE DATA:
file one:
ZipCode Name
20878 Washington
10023 Missouri
20304 Maryland
file two:
ID Name City ZipCode
11654 Arizona Phoenix 10001
12343 Washington DC 20878
12343 New Hampshire Concord 20854
54211 Maryland Silver Spring 20304
54877 Missouri St. Louis 10023
SAMPLE OUTPUT:
12343 Washington DC 20878
54211 Maryland Silver Spring 20304
54877 Missouri St. Louis 10023
These 3 rows only display because they are the rows we were looking for from file 1. Basically filtering file2 by zipcode to display all the zipcodes from file 1 but including all the other data components of file 2.
these files have like tens of thousands of rows so I wanted to retrieve all the rows in file 2 that exist with the same zip code in file 1. I thought this would be like an awk command like :
awk*-F','*'NR==FNR{c[$1]++;next};c[$4] > 0'*file2 file1
Am I not understanding the AWK command or typing something wrong? Comparing field 1 from file 1 to field 4 from file 2.