• 占楼

  • SoloPi v0.9.2 版本更新 at September 17, 2019

    请教下,如果app存在手势密码要如何处理呢

  • #统计20次进程的cpu和mem的数据,并输出平均值

    top -b -p $( ps -ef | grep Cms | grep -v grep | awk '{print $2}') -d 1 -n 20 | grep --line-buffered $( ps -ef | grep Cms | grep -v grep | awk '{print $2}') | awk 'BEGIN{OFS="\t";print "cpu","mem","avgc","avgm"}{c+=$9;m+=$10;printf "%.2f\t%.2f\t%.2f\t%.2f\n", $9,$10,c/NR,m/NR}'

    粗体内容为重复使用,未想到如何合并

  • 作业1
    less 1206.log | grep " 404 " | wc -l
    结果:10549

    less 1206.log | grep " 500 " | wc -l
    结果 :101

    cat 1206.log | awk '{print $1}'| sort | uniq -c | sort -nr | head -3

    下列为错误答案
    cat 1206.log | grep -E 'topics/[0-9]+[replis]' | wc -l

    grep -E 'topics/[0-9]+/replies' 1206.log |wc -l

    修正
    grep topics 1206.log | grep -E "topics/[0-9]{1,10}[?]{1}" | sed -E 's#/[0-9]+#:int:#g' | awk '{print $7}' | sort | uniq -c | wc -l

    grep -E " /topics/[0-9]+" 1206.log | awk '{print $7}' | sed 's#?.##g' | sed 's#/topics/[0-9]$#/topics/topics#g' | sed 's#/topics/[0-9]/replies/[0-9]/.*#topics/replies#g' | sort | uniq -c| sort -nr | head -2

    找出访问量最高的页面地址,借助于sed的统计分析。只要标准路径,把变化的数字,query参数或者变化的噪音字段全部去掉。
    作业
    cat 1206.log | awk '{print $7}' | sed -e 's#[0-9]\+/#:int:/#g' -e 's#[\?|!].*##g' -e 's#[0-9]\+$#:int:#g' -e 's#[0-9a-z-]*.png#.png#g' -e 's#[0-9a-z-]*.jpg#.jpg#g' -e 's#[0-9a-z-]*.gif#.gif#g' -e 's#[0-9a-z-]*.jpeg#.jpeg#g' -e 's#%21large##g' -e 's#/cable#/cable===#g' -e 's#/hogwarts#/hogwarts===#g' -e 's#[a-zA-Z0-9%&\$@_]{15,}#:string:#g' -e 's#^\/[0-9a-zA-Z]*$#/user#g' | sed -E 's#[a-zA-Z0-9%&\$@_]{20,}#:string:#g' | sort |uniq -c |sort -nr | less
  • 顶,每篇必看 。