需要统计用户日志信息,分析出用户行为时,用shell往往能方便地取出很多数据,取出后再放置到excel中统计。
例如:统计日志中含loadCustomProcess这个地址的访问,按访问耗时排序:
grep "loadCustomProcess" /home/workflow/socket.txt | awk -F " " '{print $11}'|awk -F ":" '{print $2...
分类:
系统相关 时间:
2014-10-24 16:43:13
阅读次数:
262
最近一直在研究shell脚本这块,刚好闲下来整了下自己手头上比较好的资料中的一些范例,以下是我整理的鸟哥私房菜里面正则表达式里面比较基础的一些语法详解,适合新手查阅。首先先复制一段范例:复制代码代码如下:# vi regular_express.txt------------------------...
分类:
系统相关 时间:
2014-10-23 12:19:46
阅读次数:
334
1、问题: 下午有同学问了这么一个问题: tail -n +$(tail -n1 /root/tmp/n) -F /root/tmp/ip.txt 2>&1| awk ‘ARGIND==1{i=$0;next}{i++;if($0~/文件已截断/){i=0};print $1"---"i;print i >> "/root/tmp/n"}‘ /...
分类:
系统相关 时间:
2014-10-23 07:04:31
阅读次数:
386
###custconfigurations###P_SN=`esxclihardwareplatformget|grep"SerialNumber"|awk-F":"‘{print$NF}‘|sed‘s///g‘`P_NAME=`esxclihardwareplatformget|grep"ProductName"|awk-F":"‘{print$NF}‘`wgethttp://10.10.10.10/config/newserverLOCAL_IPADDR=`catnewserver|grep$P_SN|a..
分类:
系统相关 时间:
2014-10-22 18:29:40
阅读次数:
708
ping测试脚本#!/bin/bash
list=iplist.txt
log=ping.log
echo-n"">$log
#清空历史日志
grep-v"#"$list|grep-v"^$">.list
#从$list文件中读出ip地址列表,去掉包含#的行和空行,结果写入.list
whilereadIP
do
echo"$IP`ping-s1000-f-c100$IP|greptransmitted|awk‘{print$6..
分类:
其他好文 时间:
2014-10-22 18:28:47
阅读次数:
188
实验名称:比较tcp和udp的丢包行为试验目的:1. 熟练用ns2做网络仿真试验的整个流程;2. 练习写tcl脚本,了解怎么应用http和rtp;3. 练习用awk处理trace数据,了解怎么计算丢包率;4. 练习用gnuplot绘制曲线图,熟练gnuplot的使用。实验步骤:1。确定网络拓扑。一个...
分类:
其他好文 时间:
2014-10-22 14:15:32
阅读次数:
283
################################################### #!/bin/bash #判断进程是否存在,如果不存在就启动它 PIDS=`ps -ef |grep myprocess |grep -v grep | awk ‘{print $2}‘` if [ "$PIDS" != "" ]; then echo...
分类:
系统相关 时间:
2014-10-21 20:00:40
阅读次数:
288
有如下3种方式:grep -P "\t"awk '/1915848\t/'ctr+c 复制 一个.
分类:
其他好文 时间:
2014-10-21 19:16:45
阅读次数:
120
# Warning! Dangerous step! Destroys VMs for x in $(virsh list --all | grep instance- | awk ‘{print $2}‘) ; do virsh destroy $x ; virsh undefine $x ; done ; # Warning! Dangerous step! Removes lots o...
分类:
其他好文 时间:
2014-10-21 17:57:47
阅读次数:
173
编写脚本review.sh: #!/bin/bash
VERSION=`svn?log?-v?--stop-on-copy?$1?|?grep?-B4?"svn?copy"?|?head?-1?|?awk?‘{print?substr($1,2)}‘`
svn?di?-r?${VERSION}:head?$1 用法脚本后跟分支...
分类:
其他好文 时间:
2014-10-20 19:44:34
阅读次数:
194