mercredi 26 mars 2014

Comparing columns in two csv files and writing result to a third.


Vote count:

0




I have two csv files with the following columns: File 1:


Q P-003430 NO PARKING (SANITATION BROOM SYMBOL) 8AM-9AM EXCEPT SUNDAY


File 2:


-73.90479333 40.70043234 5597032 P-000720 1010648.808 194477.1977 NO HOUR PARKING 8AM-10PM EXCEPT SUNDAY


I used


awk 'NR==FNR{a[$2];next}$4 in a{print $1}' alternate.csv csvtest.csv >result.csv


in order to compare the columns and get the results I want. However, the last column NO HOUR PARKING 8AM-10PM EXCEPT SUNDAY gets cut off to just NO in the last column.


For example: -73.88637197 40.85400596 5327502 P-089988 1015684.082 250435.3 NO


Is there any way to change that so I would be able to keep the whole phrase "NO HOUR PARKING 8AM-10PM EXCEPT SUNDAY" in the last column.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire