sed -r 's/.+(type)=([0-9]+).+/\2/' file echo f1 f2 f3| xargs -i -n 1 mv {} {}.bak pptp: kill `ps -ef | grep pptp | awk '{print $0}' | grep 100.10[6-7] | awk '{print $2}'` egrep "HTTP/1.1\" 5.. " api_xxx_access.log-20131017 |awk '{ print $8}' | awk -F "&" '{print $1,$2}' | sort | uniq -c | sort -rn | head -10 date -s "10/12/13 16:58:59" +%s awk多行处理: awk '{if(NR>1&&!/ms/){ print "";printf $0;} else {printf $0" ";} }' datafile hostip=`/sbin/ip a | grep -E "eth[0-9]$|em[0-9]$|bond[0-9]$|br[0-9]$" |grep "/2" | awk '{print $2}'|awk -F "/" '{print $1}' | awk -F '.' '$3 < 4 {print $0}'` | grep 192.168 hostname -i 磁盘使用量: df -Tm | grep "[0-9] " | awk '{sub(/%/,"");$6} {if($6 > 90 && $5 < 1000000) {print $0}}' 脚本日志检索: ztime=`date "+%Y-%m-%d %H:%M" -d "-15 minutes"` startnum=`cat /www/logs/application.log | grep -n "${ztime}:" | head -1 | awk -F ":" '{print $1}'` num=$(cat /www/logs/application.log | sed -n "${startnum},\$p" | grep "check comment" -c) crontab处理: crontab -l | grep -v ^# | grep -Eo '/[a-z]+.*[\w_]+.*\.sh|/[a-z]+.*[\w_]+.*\.py' | awk '{print $NF}' 检索日志: a=`date +%H:%M:%S` b=`date +%H:%M:%S -d "-5 mins"` c=`awk -F "[ |,]" '$1>="'$b'"&&$1<="'$a'"{print}' /usr/local/tomcat_chengxu2/logs/solr.log awk,两文件合并: awk 'FILENAME==ARGV[1]{a[FNR]=$1;b[FNR]=$2};FILENAME==ARGV[2]{for(i=1;i<=length(a);i++){if(a[i]==$1){print a[FNR],b[FNR],$2}}}' /tmp/file1 /tmp/file2 | sort -k2 read line with command: echo `cat ${1}error.log.$dtime | grep "110: Connection timed out" | grep -oP "192.168.[0-9.]+:[0-9]+" | sort | uniq -c | sort -rn | awk -v yuzhi=$zhi '$1 > yuzhi {print $1,$NF}'` | while read line do echo $line done
shell 笔记
原创
©著作权归作者所有:来自51CTO博客作者wyl410505的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:scp crontab远程拷贝
下一篇:yum 维护及去除重复安装包
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
[笔记]shell基础
shell基础
shell