简体   繁体   English

如果在file2中找不到file1的输出行

[英]Output line from file1 if not found in file2

I need to output the lines from file1 that are not found in file2, ideally using linux commandline. 我需要从file1中输出在file2中找不到的行,最好使用linux命令行。

Both files are uppercase AZ, sorted, per-file unique, and contain only one word per line. 这两个文件均为大写AZ,已排序,每个文件都是唯一的,并且每行仅包含一个单词。 Typically, file1 is between 5 and 100 lines long, file2 is 250,000 lines long. 通常,file1的长度在5到100行之间,file2的长度在250,000行之间。 Processing speed is not an issue. 处理速度不是问题。

grep -vhFxf file1 file2

效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从File2中提取行已找到File1 - Extract lines from File2 already found File1 当 ID 与 file2 匹配时,从 file1 复制一列,并根据文件 2 打印 output - copy a column from file1 when the ID's matches to file2 and print output according to file 2 搜索file1中包含的字符串中未找到的字符串 - Searching for strings contained in file1 that are NOT FOUND in file2 如何测试 File2 中是否存在来自 File1 每一行的 substring - How to test if a substring from each line of File1 exists in File2 使用 sed 或任何其他命令将部分行从 file1 复制到 file2 中的特定位置 - copy a part of a line from file1 to specific place in file2 using sed or any other command Perl 使用 file2 从 file1 中删除单词 - Perl removing words from file1 with file2 将带有一列的 file1 与来自 file2 的两列进行比较 - Compare file1 with one column to two columns from file2 将文件 1 中的数据追加/补充到文件 2 (linux) - Append/supplement data from file1 to file2 (linux) 如何遍历两个文件并逐行查找file1中匹配file2的所有匹配项,然后替换为file3中的内容 - How to iterate over two files and find all occurrences in file1 matching file2, line by line, then replace with content from file3 打印文件1与文件2的差异,而不从文件2中删除任何内容 - print differences of file1 to file2 without deleting anything from file2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM