是“tail“2”吗? Linux 支持吗?
我注意到Solaris ksh中支持tail +2
,但是在Red Hat Linux中,会出现错误:
c008>> ps -p 4009,6282,31401,31409 | tail +2
tail: cannot open `+2' for reading: No such file or directory
While in Solaris,
bjbldd>> ps -p 2622,16589,11719,846 |tail +2
16589 ?? 0:00 xterm
846 pts/180 0:00 cscope
11719 pts/180 0:00 cscope
2622 pts/114 0:00 apxcscop
The line of PID TTY TIME CMD
is排除通过“尾巴+2”。
我知道 grep -v PID 会起作用。但我想知道Linux tail是否有类似的选项?
I noticed that tail +2
is supported in Solaris ksh, but in Red Hat Linux, an error will occur:
c008>> ps -p 4009,6282,31401,31409 | tail +2
tail: cannot open `+2' for reading: No such file or directory
While in Solaris,
bjbldd>> ps -p 2622,16589,11719,846 |tail +2
16589 ?? 0:00 xterm
846 pts/180 0:00 cscope
11719 pts/180 0:00 cscope
2622 pts/114 0:00 apxcscop
The line of PID TTY TIME CMD
is excluded by "tail +2".
I know grep -v PID
will work. But I wonder if there is similar options for Linux tail?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自
tail(1)
:所以尝试
-n +2
或--lines=+2
:From
tail(1)
:So try
-n +2
or--lines=+2
:我熟悉 Solaris 上的
tail +2
语法,但它似乎不适用于 Ubuntu。超级用户的这个答案似乎有效:
来源:https://superuser.com/questions/ 62970/unix-cat-starting-from-line
I was familiar with
tail +2
syntax on Solaris, but it doesn't seem to work on Ubuntu.This answer from super-user seems to work:
Source: https://superuser.com/questions/62970/unix-cat-starting-from-line