Sorry for asking a question that many may think has already been asked.
I have a very long CSV data file (dat.csv) with 5 columns. I have another short CSV (filter.csv) file with 1 column.
Now, I only need to extract columns from dat.csv where column-1 matches with that of column-1 of filter.csv.
I would usually do this in BASH using sed/awk
. However, for some other reasons I need to do this within a C++ file. Can you suggest an efficient way to do this?
Sample Data:
data.csv
ID,Name,CountryCode,District,Population 3793,NewYork,USA,NewYork,8008278 3794,LosAngeles,USA,California,3694820 3795,Chicago,USA,Illinois,2896016 3796,Houston,USA,Texas,1953631 3797,Philadelphia,USA,Pennsylvania,1517550 3798,Phoenix,USA ,Arizona,1321045 3799,SanDiego,USA,California,1223400 3800,Dallas,USA,Texas,1188580 3801,SanAntonio,USA,Texas,1144646
filter.csv
3793 3797 3798