简单的文件去重复内容方法

2020年04月2日

这个方法是在hostloc社区上看到的,所以记录一下以备大伙需要的时候可以看到。

前言:有两个文件,要在B文件里删除A文件里有的内容。使用linux下的grep来实现的,这方法超简单快捷。

#文件A中不能有空行
grep -v '^ *$' A >A.tmp
grep -v -f A.tmp B >B.new

 


sicnature ---------------------------------------------------------------------
I P 地 址: 3.141.100.120
区 域 位 置: 美国
系 统 信 息: 美国
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://www.myzhenai.com.cn/post/3224.html

没有评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注