I have two .csv files where the first line in file 1 is:
MPID,Title,Description,Model,Category ID,Category Description,Subcategory ID,Subcategory Description,Manufacturer ID,Manufacturer Description,URL,Manufacturer (Brand) URL,Image URL,AR Price,Price,Ship Price,Stock,Condition
The first line from file 2:
Regular Price,Sale Price,Manufacturer Name,Model Number,Retailer Category,Buy URL,Product Name,Availability,Shipping Cost,Condition,MPID,Image URL,UPC,Description
and then rest of every file is filled with info.
As you can see, both files have a common field called MPID (file 1: col 1, file 2: col 9, where the first col is col 1).
I would like to create a new file which will combine these two files by looking at this column (as in: if there is an MPID that is in both files, then in the new file this MPID will appear with both its row from file 1 and its row from file 2). IF one MPID appears only in one file then it should also go into this combined file.
The files are not sorted in any way.
How do I do this on a debian machine with either a shell script or python?
Thanks.
EDIT: Both files dont have commas other than the ones separating the fields.
See Question&Answers more detail:
os