选项 -f 用于 linux 命令

0 linux arguments uniq

这是测试文件的内容:

this this  
this that  
is that  
a that  
MAP that  
map that  
Run Code Online (Sandbox Code Playgroud)

当我这样做时uniq testCase -f1,结果是:

this this  
this that  
Run Code Online (Sandbox Code Playgroud)

这是合理的,但如果我运行: testCase -f2,我会得到:

this this 
Run Code Online (Sandbox Code Playgroud)

为什么会这样?谁能告诉我 -f 的默认分隔符是什么,它不在 man 中。

Mat*_*Mat 5

来自man uniq

字段是一连串空格(通常是空格和/或制表符),然后是非空白字符。在字符之前跳过字段。

由于-f2您正在跳过所有字段,因此只有第一行获得输出,第二个字段之后的所有其他字段都相等(没有超过两个)。