Linux是否支持“ tail +2”?

问题描述

| 我注意到Solaris ksh支持ѭ0,但是在Red Hat Linux中会发生错误:
c008>> ps -p 4009,6282,31401,31409 | tail +2
tail: cannot open `+2\' for reading: No such file or directory
在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
“3ѭ的行被\” tail +2 \“排除。 我知道ѭ4会起作用。但是我想知道Linux tail是否有类似的选择吗?     

解决方法

        从
tail(1)
   -n,--lines=K
          output the last K lines,instead of the last 10; or
          use -n +K to output lines starting with the Kth
因此,尝试
-n +2
--lines=+2
$ ps -p 20085 9530 29993 2069 2012 | tail -n +2
 2012 ?        Sl     0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
 2069 ?        S      0:00 /usr/bin/dbus-launch --exit-with-session i3
 9530 ?        Sl     0:01 /usr/lib/udisks/udisks-daemon
20085 ?        S      0:00 /usr/sbin/apache2 -k start
29993 ?        S      0:00 [kworker/1:0]
$ 
    ,        我在Solaris上熟悉
tail +2
语法,但在Ubuntu上似乎不起作用。 超级用户的这个答案似乎可行:
tail --lines=+100 <file> 
资料来源:https://superuser.com/questions/62970/unix-cat-starting-from-line     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...