我有两个文件和一个号码列表(电话号码).
我正在寻找一种在第二个文件中列出第一个文件中没有的数字的方法.
我try 过各种方法:
comm (getting some weird sorting errors)
fgrep -v -x -f second-file.txt first-file.txt (unsure of the result, there should be more)
我有两个文件和一个号码列表(电话号码).
我正在寻找一种在第二个文件中列出第一个文件中没有的数字的方法.
我try 过各种方法:
comm (getting some weird sorting errors)
fgrep -v -x -f second-file.txt first-file.txt (unsure of the result, there should be more)
grep -Fxv -f first-file.txt second-file.txt
基本上在second-file.txt
中查找所有与first-file.txt
中的任何一行都不匹配的行.如果文件很大,速度可能会很慢.
此外,一旦对文件进行了排序(如果是数字,则使用sort -n
),那么comm
也应该有效.它给出了什么错误?试试这个:
comm -23 second-file-sorted.txt first-file-sorted.txt