LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Shell Script for CSV file comparision (https://www.linuxquestions.org/questions/programming-9/shell-script-for-csv-file-comparision-705266/)

aravind_balan 02-17-2009 01:19 AM

Shell Script for CSV file comparision
 
Hi,
I have 2 CSV files. let say emp_data_Jan.csv (will contain the data of employees till Jan) and emp_data_feb.csv (will contain the data of employees till Feb). I need a Shell script which can read both these files and compare the data between emp_data_Jan.csv and emp_data_feb.csv. After comparision i need the output data in new CSV file. Output data will be records which are present in emp_data_Feb.csv and not in emp_data_Jan.csv. Can any one help me on this.

Thanks in Advance

Regards
Arvind

H_TeXMeX_H 02-17-2009 03:33 AM

Try reading 'man comm', I believe comm in the program you need for this. Probably something like:

Code:

comm -1 emp_data_Feb.csv emp_data_Jan.csv > new.csv


All times are GMT -5. The time now is 06:11 PM.