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.
new.txt好的,如果它们在,我该如何删除它们tried.txt,
new.txt
tried.txt
例如,如果new.txt包含 123 并tried.txt包含 123,则将 123 从中删除in.txt并将结果输出到new2.txt。
in.txt
new2.txt
使用grep:
grep
grep -F -x -v -f tried.txt new.txt > new2.txt
使用awk:
awk
awk "NR==FNR{a[$0];next} !($0 in a)" tried.txt new.txt > new2.txt
上述任何命令都应该适合您。看: