更新时间:2023-11-30 20:31:46
假设顺序并不重要,
grep -F -f FILE2 FILE1
应该做的伎俩。 (这工作,因为一个鲜为人知的事实:在 -F
选项的grep
并不仅仅意味着比赛这种固定字符串,它意味着匹配任何这些换行符分隔固定字符串。)
should do the trick. (This works because of a little-known fact: the -F
option to grep
doesn't just mean "match this fixed string," it means "match any of these newline-separated fixed strings.")