本小菜鸟想在shell 中实现这样的功能 在a文件中如果含有“sucess”的字符,程序就继续进行,否则就打印错误,并推出 grep的查询结果怎么才能用到if中去呢? 或者有什么其他的方法可以实现 请各位大侠赐教!!
[work@w-m2 ~/software/hbase/conf]$ grep -n 'ratio' *.xml
hbase-default.xml:2:
hbase-default.xml:24:
本帖最后由 luofeiyu_cu 于 2012-10-05 10:36 编辑 grep -l "mysed" /home/test 可以找出所有包含mysed的文章,假定有3个结果:/home/test/sed1,/home/test/sed2,/home/test/sed3 1.用firefox打开第2个结果 2.用firefox打开所有的结果 请问,如何用shell命令来完成?
prtconf_grep memory的结果 : memory (driver not attached) virtual-memory (driver not attached) memory-controller, instance #0 memory-controller, instance #1 过去曾经看到应该是显示4096M,但为何现在显示的是这个?
prtconf_grep memory的结果 :\r\n\r\n\r\n memory (driver not attached)\r\n virtual-memory (driver not attached)\r\n memory-controller, instance #0\r\n memory-controller, instance #1\r\n\r\n\r\n过去曾经看到应该是显示4096M,但为何现在显示的是这个?
我执行了几个命令,但结果却不明白怎么回事,哪位大虾给指点指点啊?命令如下: $ grep u* t.txt ui u* lskdj` $ grep u t.txt ui u* $ grep * t.txt ls.tx:cat.out ls.txt:cat.out
本帖最后由 prcardin 于 2015-04-30 10:01 编辑 grep得到的结果再处理 grep "dostr" $dir/*.txt action:dostr,m_uno:yx_hlld_93325534096,u_no:555523245,qd:yx.zhuanfa,plat:ANDROID,udno:d657c535-3avb-37bn-67ad-676689wer,server:10010,name_name:ither,ip:192.18.48.56 ,dostr_time:2014-10-01 01:54:24,name_exp:0987015,mi:100,currency:CNY,amount:1000,dostr_channel:HGFG,dono:5476_001_57788563424_894718199528...
本帖最后由 xiaoshichao143 于 2012-07-12 17:56 编辑 [code]printf 'a b\nc d\n\n\n\n\n\000\n\000e\000\000\nf' | grep -cz . printf 'a b\nc d\n\n\n\n\n\000\n\000e\000\000\nf' | grep -cz '$' printf 'a b\nc d\n\n\n\n\n\000\n\000e\000\000\nf' | grep -cz '^' printf 'a b\nc d\n\n\n\n\n\000\n\000e\000\000\nf' | grep -c '$'[/code]求指教
for recode in `grep searchkey infile`;do echo $recode done 当检索结果过长的情况 比如,结果为abcd...................12345..... 会被切成2,3行 结果输出后 adcd............ 12345...... ..... 怎么才能不被切呢??
[code]@a=qw(aa bb cc dd ee); push @a,"ff"; @b=qw(aa bb cc dd ee); push @b,"gg"; for(@b){ print grep /$_/,@a; print "\n"; }[/code] 怎么结果是: aabbccddeeff aabbccddeeff aabbccddeeff aabbccddeeff aabbccddeeff aabbccddeeff 的? 不是 aa bb cc dd ee 的吗? 怎么有这样的差别的? [ 本帖最后由 liang573728 于 2008-4-11 13:42 编辑 ]