使用shell脚本在csv中找到缺少的行 [英] Find missing lines in csv using shell script

查看:201
本文介绍了使用shell脚本在csv中找到缺少的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每天得到一个csv文件,并希望与前一天的文件进行比较。添加新行,在现有行中进行多个更改,并删除一些行。

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.

我可以处理文件的所有更改,但丢失行。
我如何在cron作业中使用shell脚本获取丢失的行?

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?

我想将丢失的行放在第三个csv文件中处理

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

推荐答案

man diff

使用diff,您可以获得两个文件之间的更改。
然后根据你想要如何处理它们,只需 grep 输出 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.

这篇关于使用shell脚本在csv中找到缺少的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆