正如我所注意到的,诸如之类的命令以
tail -n +5 a b
如下格式打印其输出:
==>a<==
contents of a from line 5 to $EOF (including line 5)
==>b<==
contents of b from line 5 to $EOF (including line 5)
有没有办法(或者可能是另一个命令)只打印指定行以后所需的内容? IE:
contents of a from line 5 to $EOF (including line 5)
contents of b from line 5 to $EOF (including line 5)
答案1
使用安静选项:
tail -q -n +5 a b
答案2
文件信息写入 stderr,实际数据写入 stdout(两者都应该如此)。所以即使没有-q
选择你也可以把它扔掉
tail ... 2>/dev/null
如果您重定向tail
输出,则文件信息无论如何都不会被重定向:
tail ... >output