ChinaUnix.net
相关文章推荐:

grep 多个条件

例如,我想将某个文件中所有含dns和DNS的串所在行列出来,如何操作? 谢谢!

by victor_hu - Solaris - 2005-04-30 22:58:14 阅读(3550) 回复(3)

相关讨论

比如我想 grep ".c" 或者 grep ".cpppp"

by cookis - Shell - 2006-09-22 17:57:20 阅读(1239) 回复(2)

要被匹配的字串 [code] Re: <5664ddff?$??o2> [/code] 单独匹配无问题 [code] # echo 'Re: <5664ddff?$??o2>'| grep "Re: <5664ddff?\$??o2>$" Re: <5664ddff?$??o2> # echo $? 0 [/code] 匹配,就不对了 [code] # echo 'Re: <5664ddff?$??o2>'| grep -E "Re: <5664ddff?\$??o2>$|hi" # echo $? 1 [/code] 谁知道这是什么原因,有什么办法解决。 除了grep sed能做匹配吗?能否给个例子。 awk呢 是否是grep最快?...

by wienne - Shell - 2004-04-15 13:03:12 阅读(1041) 回复(3)

Timecounters tick every 1.000 msec hptrr: no controller detected. Waiting 5 seconds for SCSI devices to settle ad0: 8192MB at ata0-master UDMA33 acd0: CDROM at ata1-master UDMA33 da0 at mpt0 bus 0 target 0 lun 0 da0: Fixed Direct Access SCSI-2 device da0: 80.000MB/s transfers (40.000M...

by yankai0403 - Shell - 2008-12-22 21:59:23 阅读(3210) 回复(5)

grep如何实现条件查询? 假设我要同时匹配ABC和XYZ,不要告诉我用 grep 'ABC' | grep 'XYZ' 这个方法 我想把它写到一个条件

by xwmhmily - Shell - 2008-07-17 11:10:36 阅读(20509) 回复(15)

li@mail test]# cat gt one two three four five six one two one seven three [li@mail test]# grep one three gt grep: three: No such file or directory gt:one two three gt:one two gt:one seven three 我的原意是:截取出现one 和 three的行,结果应该是: one two three one seven three 能不能不用管道的方式实现( cat gt | grep one | grep three ) 而直接用一个grep命令?

by paulwang - Shell - 2008-07-16 10:13:16 阅读(5444) 回复(18)

[li@mail test]# cat gt one two three four five six one two one seven three [li@mail test]# grep one three gt grep: three: No such file or directory gt:one two three gt:one two gt:one seven three 我的原意是:截取出现one 和 three的行,结果应该是: one two three one seven three 能不能不用管道的方式实现( cat gt | grep one | grep three ) 而直接用一个grep命令?

by paulwang - Linux论坛 - 2004-05-14 14:28:04 阅读(2299) 回复(15)

想在 grep 中匹配关键字中的一个就输出 除了正则以外有没有办法. 或者是正则也行. 要匹配的字会串包括: "0x72999925" "0x72999927" "0x72999928" "0x72999929" 注意,我的文件里有 "0x72999926"的行不输出.

by chouy - 系统管理 - 2006-12-05 13:03:02 阅读(4814) 回复(3)

比如: $ cat test abc def 如何使用grep 同时检索 abc 和 def ?

by 零二年的夏天 - Linux论坛 - 2004-02-26 17:25:39 阅读(1451) 回复(11)

有时可能需要用sed ,awk同时匹配单词,总结了前辈们的方法,在我的CentOS 5下测试通过: 同时匹配kobe和james: sed -n '/kobe/{/james/p}' awk '/kobe/&&/james/{ print $0 }' grep -E '(kobe.*james|james.*kobe)' 匹配kobe或james: sed -n '/\(kobe\|james\)/p' awk '/kobe/||/james/{ print $0 }' grep -E '(kobe|james)' 今天把grep加上去了,有不妥之处,请指教 [ 本帖最后由 xwmhmily 于 2008-7-16 23:...

by xwmhmily - Shell - 2008-07-17 19:26:50 阅读(16403) 回复(6)

如题,谢谢。我自己试了,不行,是不是要加入什么逻辑与之类的?如何加?

by eikes - Shell - 2008-06-04 17:52:00 阅读(18343) 回复(14)