Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑我有 2 个文本文件,两个文件中的每一行都包含由“|”分隔的某些字段。如果我使用第 3 列对文件进行了排序,是否comm -23 file1.txt file2.txt > difference.txt给了我 file1.txt 中存在的行而不是file2.txt 中的行?
comm -23 file1.txt file2.txt > difference.txt
提前致谢。
不,您只能将 comm 用于从行首排序的文件。 您可以制作一个脚本,对第 1 列的文件进行排序,使用 comm,然后在第 3 列排序。