linux – 获取不在file2中的file1行

linux – 获取不在file2中的file1行,第1张

概述我有两个很长但已排序的文件.如何获取不在第二个文件中的第一个文件的所有行? 文件1 0000_aaa_b0001_bccc_b0002_bcc <------ file2 have not that line0003_aaa_d0006_xxx... 文件2 0000_aaa_b0001_bccc_b0003_aaa_d0006_xxx... 这是comm命令的用途: $comm 我有两个很长但已排序的文件.如何获取不在第二个文件中的第一个文件的所有行?

文件1

0000_aaa_b0001_bccc_b0002_bcc <------ file2 have not that line0003_aaa_d0006_xxx...

文件2

0000_aaa_b0001_bccc_b0003_aaa_d0006_xxx...
解决方法 这是comm命令的用途:
$comm -3 file1 file20002_bcc

来自man comm:

DESCRIPTION   Compare sorted files file1 and file2 line by line.   With  no  options,produce  three-column  output.  Column one contains   lines unique to file1,column two contains lines unique to  file2,and   column three contains lines common to both files.   -1     suppress column 1 (lines unique to file1)   -2     suppress column 2 (lines unique to file2)   -3     suppress column 3 (lines that appear in both files)
总结

以上是内存溢出为你收集整理的linux – 获取不在file2中的file1行全部内容,希望文章能够帮你解决linux – 获取不在file2中的file1行所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/1037088.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存