从tail
手册页:
所述尾实用程序显示的内容文件或默认,它的标准输入,标准输出。
显示从输入中的字节、行或 512 字节块位置开始。具有前导加号 (“+”) 的数字相对于输入的开头,例如,“-c +2”在输入的第二个字节处开始显示。具有前导减号(“-”)或没有显式符号的数字相对于输入的结尾,例如,“-n 2”显示输入的最后两行。默认起始位置是“-n 10”,即输入的最后 10 行。
因此,在您的情况下,tail +3
(-n
隐含)意味着从输入 ( ls -l
)的第 3 行开始并打印其余部分。例如:
ls -l
输出:
total 0
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file1
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file2
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file3
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file4
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file5
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file6
Run Code Online (Sandbox Code Playgroud)
ls -l | tail +3
输出:
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file2
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file3
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file4
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file5
-rw-r--r-- 1 carl staff 0 Oct 28 13:18 file6
Run Code Online (Sandbox Code Playgroud)
相同的输出,只是去掉了前几行。
归档时间: |
|
查看次数: |
1790 次 |
最近记录: |