免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8927 | 回复: 4
打印 上一主题 下一主题

ps aux|grep aaa如果去掉自己这一行 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-22 20:44 |只看该作者 |倒序浏览
最后一行总是自己,如何不要这一行??

比如
[root@server57 bin]# ps axu|grep tty
root      2477  0.0  0.0  1524  408 tty1     Ss+  Jun21   0:00 /sbin/mingetty tty1
root      2478  0.0  0.0  2248  404 tty2     Ss+  Jun21   0:00 /sbin/mingetty tty2
root      2479  0.0  0.0  1540  408 tty3     Ss+  Jun21   0:00 /sbin/mingetty tty3
root      2480  0.0  0.0  2556  408 tty4     Ss+  Jun21   0:00 /sbin/mingetty tty4
root      2481  0.0  0.0  3068  404 tty5     Ss+  Jun21   0:00 /sbin/mingetty tty5
root      2482  0.0  0.0  1828  408 tty6     Ss+  Jun21   0:00 /sbin/mingetty tty6
root     18784  0.0  0.0  4012  656 pts/0    S+   20:12   0:00 grep tty

不要最后一行,怎么做?

论坛徽章:
0
2 [报告]
发表于 2006-06-22 20:54 |只看该作者
man grep
...
       -v, --invert-match
              Invert the sense of matching, to select non-matching lines.

...

论坛徽章:
0
3 [报告]
发表于 2006-06-22 21:00 |只看该作者
原帖由 iesc 于 2006-6-22 20:54 发表
man grep
...
       -v, --invert-match
              Invert the sense of matching, to select non-matching lines.

...



不懂呢

论坛徽章:
7
荣誉版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07狮子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10双子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
4 [报告]
发表于 2006-06-22 21:27 |只看该作者
两种方法:
ps axu|grep [t]ty
or
ps axu|grep tty|grep -v grep

论坛徽章:
0
5 [报告]
发表于 2006-06-22 21:35 |只看该作者
明白了。谢谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP