Chinaunix
标题:
grep什么选项是忽略grep的内容列出
[打印本页]
作者:
szww
时间:
2013-01-31 00:13
标题:
grep什么选项是忽略grep的内容列出
比如 ps aux| grep sap
输出应该有grep sap这一项,我如何在输出内容中过滤掉?
谢谢!
作者:
dn833
时间:
2013-01-31 07:12
ps aux| grep sap$
或
ps aux| grep [s]ap
复制代码
试试看吧
作者:
asdf2110
时间:
2013-01-31 09:08
ps aux| grep sap | grep -v grep
复制代码
作者:
blackold
时间:
2013-01-31 09:33
回复
1#
szww
ps aux| grep '[s]ap'
复制代码
作者:
zooyo
时间:
2013-01-31 09:47
提示:
作者被禁止或删除 内容自动屏蔽
作者:
reyleon
时间:
2013-01-31 09:50
围观下
作者:
wang_xue_m
时间:
2013-01-31 09:54
ps aux| grep sap|grep -v grep
作者:
Shell_HAT
时间:
2013-01-31 10:24
本帖最后由 Shell_HAT 于 2013-01-31 10:24 编辑
ps aux| grep sap | grep -v $$
作者:
seesea2517
时间:
2013-01-31 11:47
回复
4#
blackold
这个好神奇,以前不知道有这样的效果,学习学习。
作者:
szww
时间:
2013-02-01 11:21
本帖最后由 szww 于 2013-02-01 11:23 编辑
非常不错!贴上命令结果:
[root@COI ~]# ps -ef |grep sap
root 2397 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/saphostexec pf=/usr/sap/hostctrl/exe/host_profile
sapadm 2417 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/sapstartsrv pf=/usr/sap/hostctrl/exe/host_profile -D
coiadm 2593 1 1 11:17 ? 00:00:01 /usr/sap/COI/DVEBMGS00/exe/sapstartsrv pf=/usr/sap/COI/SYS/profile/START_DVEBMGS00_COI -D -u coiadm
daaadm 2715 1 0 11:17 ? 00:00:00 /usr/sap/DAA/SMDA97/exe/sapstartsrv pf=/usr/sap/DAA/SYS/profile/DAA_SMDA97_COI -D -u daaadm
root 3015 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/saposcol -l -w60 pf=/usr/sap/hostctrl/exe/host_profile
root 3463 3431 0 11:20 pts/0 00:00:00 grep sap
[root@COI ~]# ps -ef |grep sap|grep -v $$
root 2397 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/saphostexec pf=/usr/sap/hostctrl/exe/host_profile
sapadm 2417 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/sapstartsrv pf=/usr/sap/hostctrl/exe/host_profile -D
coiadm 2593 1 0 11:17 ? 00:00:01 /usr/sap/COI/DVEBMGS00/exe/sapstartsrv pf=/usr/sap/COI/SYS/profile/START_DVEBMGS00_COI -D -u coiadm
daaadm 2715 1 0 11:17 ? 00:00:00 /usr/sap/DAA/SMDA97/exe/sapstartsrv pf=/usr/sap/DAA/SYS/profile/DAA_SMDA97_COI -D -u daaadm
root 3015 1 0 11:17 ? 00:00:00 /usr/sap/hostctrl/exe/saposcol -l -w60 pf=/usr/sap/hostctrl/exe/host_profile
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2