Find missing lines in csv using shell script

2019-09-20 07:09发布

问题:

I get an csv file every day and would like to compare with the file from the day before. New lines are added, several changes are made in existing lines and some lines are removed.

I could handle all changes of the file except the losing lines. How could i get the missing lines using a shell script in a cron job?

I would like to put the missing Lines in a third csv file to handle them seperatly.

回答1:

man diff

Using diff, you can get the changes between two files. Then depending on how you want to handle them, just grep the output of diff to get what you want.