求教grep的用法:使用grep -f时,明明是两个文件都有的行,为什么换下次序效果会不一样?

q$ fgrep -f test1 test1 -n -i 1:A2:BC3:DD4:E5:ABCABCABC6:QAQAQAQAq$ fgrep -f test2 test2 -n -i 1:BB霜2:A3:QA4:ABC5:ABCDD6:DD7:ACDEB8:EEEEEEE9:Eq$ fgrep -f test1 test2 -n -i q$ fgrep -f test2 test1 -n -i 1:A3:DD4:E5:ABCABCABC6:QAQAQAQA
2026年09月25日 23:32
有1个网友回答
网友(1):

要弄清楚-f这个option的含义:

-f file
--file=file
Obtain patterns from file, one per line.
The empty file contains zero patterns, and therefore matches nothing.
(-f is specified by POSIX.)