ChinaUnix.net
相关文章推荐:

linux grep 或

请问达人grep有无“与”“”选项? 例如查找一文件中包含的“aaa”" 和 "bbb"字符串的行如何弄呢。笨方法是执行两次grep 但是这样源文件中的aaa bbb 关系看不出来。例如原文aaa c=1; bbb c=1 ;。。。; aaa d ;。。。。。。。。。bbb d; aaa d 。我想提出来的aaa行和bbb行顺序和原文一致,如果用两次grep就不对了 最好大家能给出用grep的方法。awk和sed也欢迎

by fortuneteller - Shell - 2008-08-05 08:53:30 阅读(2630) 回复(10)

相关讨论

abcd="A|D|a1|a2" cat file1.txt |egrep "$abcd" > file2.txt 为什么file2.txt是空。 file1.txt文件内容: A 21123 b 923342 D 3213412 a1 2231243 a2 98766 B 892317

by zhkun - Shell - 2006-03-03 09:58:28 阅读(1724) 回复(5)

grep -c string1 file grep -c string2 file 如果写到一行里 grep -c string1string2 file 同样,与和非操作怎么写?

by bdw - Shell - 2004-08-04 14:14:02 阅读(1121) 回复(2)

比如我想搜索 /etc/passwd 包含 root 者 daemon 的关键字应该怎么写? 感谢.

by signmem - Shell - 2009-02-25 12:03:38 阅读(1201) 回复(3)

在LINUX,AIX,HP—UX下,都可以用grep -E实现grep的“”条件查找, 即: grep -E condition1|condition2|condition3..... 但是在Solaris9.0下,这个功能却无法实现,因为grep无法带"-E", 如果想在Solaris下实现这个功能,grep该如何写啊?谢谢各位了,这个问题困扰我好久了。

by everester - Shell - 2007-11-01 17:32:34 阅读(1574) 回复(1)

格式: grep -E 'A1 | A2 | A3' filename 用这种方式去匹配文件, 其中的 A1 A2 A3的个数有限制吗? 是否可以无限制的扩展为 grep -E 'A1 | A2 | A3 | A4 | .......| A100' filename 急需知情人解答 谢谢。

by myj1614 - Shell - 2007-04-18 17:42:21 阅读(1900) 回复(2)
by Ray001 - Shell - 2006-09-19 21:39:09 阅读(1421) 回复(4)
by philonis - Shell - 2005-03-18 15:19:53 阅读(1805) 回复(2)

问题:通过下面命令可以把结果输出到文件里 vmstat > /file top |tee -a /file 可是下面却不行, vmstat 1 >/filevmstat 1 |tee -a /file top -d 1| grep Mem |tee -a /filetop |grep Mem >/file 请教如何把vmstat 1top | grep Mem 的结果输出到文件里?

by 明月清风 - Shell - 2004-09-27 19:14:18 阅读(4536) 回复(5)

成功的样例 wld.log Table CIN_CAPACITY_INFORMATION_NEW: 312 Rows successfully loaded. 0 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. 如果下面这三行都是以0开头,表示没有失败的记录,即全部成功,如何用grep命令表示 0 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses wer...

by jack7527 - Shell - 2004-05-14 17:15:52 阅读(1577) 回复(5)

Apache/2.0.50 (Gentoo/linux) Server at www.apache.org Port 80 (Gentoo/linux)(RedHat/linux)(Unix)字样是整样编译到apache里的啊?可以修改吗?

by rosaxe - BSD - 2004-08-27 08:26:19 阅读(862) 回复(1)