做一统计,取得每个月中每天的统计数据,加到一块汇总. while read line do cat $path/$line/sendreceive-$year$before_month_at_year\(0\?\[1-9\]\|\[12\]\[0-9\]\|3\[01\]> $path/$line/sendreceive-$year$before_month_at_year-bak-$line awk '{a[$1]+=$2;b[$1]+=$3}END{for (i in a){print i,a[ i ],b[ i ]}}' $path/$line/sendreceive-$year$before_month_at_year-bak-$line >$path/$line/before_sendreceive...
by iamwzh2003 - Shell - 2009-08-05 10:11:20 阅读(1303) 回复(2)
在一个目录下 touch ab abc a1 a2 a3 all a12 ba ba.1 ba.2 filex filey AbC ABC ABc2 abc 然后 ls [A-Z][A-Z][A-Z] 我觉得应该是显示由三个大写字母组成的文件或者目录,这里应该输出ABC 但是结果是 AbC ABC 这是什么原因呢?
在javascript中,比如要测试一个表单的邮件输入项是否符合规则,要写一个 正则表达式.比如: ........ var pattern=/^[a-zA-Z0-9-_]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]/; if (pattern.test(emai)){ ...... } .......... 也就是说在javascript中使用正则表达式必须要有定界符/.../. 为什么在linux的shell中使用正则表达式时,没有这个定界符呢?
文本内容如下: [root@localhost ~]# cat passwdtest ricci:x:101:102 rii:x:101:102 rici:x:101:102 ricccccci:x:101:102 执行grep 'ric*i' passwdtest 指令的结果,本人认为在此指令中将 'ric*i' 置于了 单引号中,即代表不用shell解释此表达式,用正则表达式解释了此字符串,所以这个结果是正常的 [root@localhost ~]# grep 'ric*i' passwdtest ricci:x:101:102 rii:x:101:102 rici:x:101:102 ricccccci:x:101:102 然后执行...
shell 中的sed 和perl 中的替换功能s/// 的问题 例: s,^,'$( cat file1 )' (shell) perl 中能不能实现$(cat file1)这样的功能。 谢谢各位了。 [ 本帖最后由 zhangkeyijian 于 2007-3-30 19:37 编辑 ]