- 浏览: 1453709 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
http://www.reddragonfly.org/abscn/sedawk.html
无故而知新,变化少的东西最值得学
假如日志这样:
每天23:59:00到23:59:59的触发量
如果awk要传参数:
http://www.cnblogs.com/chengmo/archive/2010/10/03/1841753.html
无故而知新,变化少的东西最值得学
假如日志这样:
2011-07-18 16:38:07,118 <compile template:309648278 Subject 1293> 2011-07-18 16:38:08,190 <compile template:309647501 Subject 2176> 2011-07-18 16:38:08,235 <compile frag:204186936 1559> 2011-07-18 16:38:08,628 <compile template:204186936 Subject 1952>
#!/bin/sh echo $1 if [ -z "$1" ];then echo "need one parameter"; exit 1; fi grep "compile template:.* $1" test/* >hao.txt sed -e "/.*>/ s/\\(\d\\)*>/\\1/" hao.txt >hao1.txt #sed -e "/2011-07-18 15/,/2011-07-18 16/p" hao1.txt >hao.txt awk 'BEGIN{max=0;sum=0;col=0;}{if($6>max){max=$6};sum+=$6;col++}END{print "max="max" sum="sum" avg="sum/col}' hao1.txt exit 1;
每天23:59:00到23:59:59的触发量
#!/bin/sh echo $1 if [ -z "$1" ];then echo "need one parameter"; exit 1; fi grep "compile template:.* $1" test/* >hao.txt sed -e "/.*>/ s/\\(\d\\)*>/\\1/" hao.txt >hao1.txt #sed -e "/.*>/ s/\\(\d\\)*>/\\1/" hao.txt|sed -e "/,/ s/,/ /">hao2.txt sed -e "/,/ s/,/ /" hao1.txt >hao2.txt #sed -e "/2011-07-18 15/,/2011-07-18 16/p" hao1.txt >hao.txt awk 'BEGIN{max=0;sum=0;col=0;}{if($2>"23:59:00" && $2<"23:59:59"){if($7>max){max=$7};sum+=$7;col++}}END{print "count="col" max="max" sum="sum" avg="sum/col}' hao2.txt #awk 'BEGIN{max=0;sum=0;col=0;}{if($2>"23:59:00" && $2<"23:59:59"){print}}END{print "count="col" max="max" sum="sum" avg="sum/col}' hao2.txt exit 1;
#!/bin/sh begintime=00:00:00; endtime=23:59:59; argoption[1]="saveOrUpdateNews"; argoption[2]="runplugin.*newscommon"; argoption[3]="runplugin.*wireless"; argoption[4]="postHandle"; argoption[5]="update news"; #argoption[1]="compile frag"; #argoption[2]="compile template:.* EntityItem"; #argoption[3]="compile template:.* Subject"; #argoption[4]="compile template:.* News"; #for strr in ${option[*]} for strr in $(seq 5) do echo ${argoption[$strr]}; grep "${argoption[$strr]}" item/* >hao.txt sed -e "/.*>/ s/\\(\d\\)*>/\\1/" hao.txt >hao1.txt; sed -e "/,/ s/,/ /" hao1.txt >hao2.txt; awk -v btime="$begintime" -v etime="$endtime" 'BEGIN{max=0;min=1000;sum=0;col=0;}{if($2>=btime && $2<=etime) {if($NF>max){max=$NF};if($NF<min){min=$NF};sum+=$NF ;col++}}END{print "count="col" max="max" sum="sum" avg="sum/col" min="min }' hao2.txt; rm hao*.txt; done
如果awk要传参数:
http://www.cnblogs.com/chengmo/archive/2010/10/03/1841753.html
发表评论
-
vim复制代码包含注释时格式会乱掉(转)
2013-07-16 10:47 3470乱码问题 一般来说只需要正确设置vim的编码识别序列就很少会遇 ... -
批量替换文件后缀名
2012-10-22 22:49 744for j in *.aga; do echo ` mv $j ... -
路由相关的的一些东西
2012-10-03 11:01 1029熟悉使用ifconfig 会非常方便。 if ... -
ubuntu脚本有区别rename和bash
2012-09-30 11:25 6286在ubuntu上写法有区别 使用 #!/bin/bash代替# ... -
一些常用的shell
2012-08-29 20:37 1084sudo !! 2009-01-26 10:26:48 Use ... -
itop
2012-06-26 23:06 1419Linux下中断来源可以从 /proc/interrupts ... -
telnet发邮件
2012-06-26 23:05 1718参考。http://forum.ubuntu.org.cn/v ... -
vim折叠和vim相关
2011-12-03 11:16 1194http://blog.csdn.net/namecyf/ar ... -
sed常用
2011-11-21 10:37 1489转http://blog.chinaunix.net/sp ... -
vim常用参数
2011-11-21 09:46 845cat - aa.txt >bb.txt cat -v ... -
awk的helloworld
2011-11-18 17:08 920两次过滤 awk -F '"' '{print $2 ... -
Print without executing the last command that starts with
2011-11-10 14:24 976Print without executing the las ... -
shell的function
2011-10-24 10:22 1103#!/bin/sh #/bin/sh hello(){ ... -
(转)查看网卡流量shell脚本工具
2011-10-19 10:10 929http://www.mysqlops.com/2011/10 ... -
看错误号的定义
2011-09-22 09:14 928perl -MPOSIX -e 'print strerror ... -
diff和patch
2011-09-08 23:31 993网上找的,摘抄 diff和patch是一对工具,在数学上来说, ... -
mkfifo 和nc
2011-08-25 00:00 1657服务器端 nc -l 1234 客户端 nc 10.10.10 ... -
linux date时间戳互相转换
2011-08-17 15:15 400151.查看指定时间的时间戳 查看当前时间 #date + ... -
linux修改主机名
2011-07-21 09:32 1056转http://hi.baidu.com/sunshibing ... -
转unix文本格式转换
2011-07-20 09:33 2009转http://wly719.iteye.com/blog/5 ...
相关推荐
sed & awk 第二版 例程 源代码 源码 sed & awk sourcecode
Sed&Awk 2th Edition, 学习Sed与AWK的好资料
sed 和 awk 命令的详细使用方法和说明,英文版,高清,带目录。
sed & awk 汇总 sed & awk 汇总 sed & awk 汇总
关于Sed以及Awk的使用文档,可以帮助提升脚本语言shell的使用。
English 2nd Edition 2002 chm format Summary of sed & awk
当今介绍sed和awk工具的最经典的资料,好好读下去,才能感受到它们的强大 这也是我找到最清晰的一本
sed&awk学习手册,是根据英文文档群内成员自己翻译的。sed&awk很实用的学习手册。和大家共享一下。2分哦。
proficient in Sed and Awk. Sed and Awk are two great utilities that can solve a lot of complex tasks quickly with only a few lines of code--in most cases, with just a single line of code.
sed&awk 英文版,中文版的不清晰,这个是英文版的,绝对清晰,又学技术又学英文
《sed & awk》中文版 Linux下awk、sed介绍
sed&awk初步1
英文版的sed & awk 2nd editon,在网上找到最好的版本了。
sed & awk 中文 第二版 影印版,还算清晰
awk&sed 详解 shell awk&sed 详解 shell awk&sed 详解 shell awk&sed 详解 shell awk&sed 详解 shell awk&sed 详解 shell
Sed(Stream EDitor)为 UNIX 系统上提供将编辑工作自动化的编辑器
sed与awk 编写脚本利器。
Linux 中 Sed Awk 的操作。If you are a developer, or system administrator, or database administrator, or IT manager, or just someone who spends a significant amount of time on UNIX / Linux, you should ...
喜欢shell脚本者,这是一本不错的书,希望对大家有点帮助