• Shell脚本的编写


    筛选后统计总数

    cat logs | grep IconsendRedirect | wc -l >> bb.log

    筛选后分类统计并且排序

    cat logs | grep IconsendRedirect | awk '{{FS=" "}s[$11] ++}END{ for(i in s){ print i, s[i] } }' >> bb.log

    赋予*.sh文件执行权限

    chmod u+x *.sh

    根据关键字筛选指定列

    cat /data/tools/apache-tomcat-8085/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    cat /data/tools/apache-tomcat-8086/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    cat /data/tools/apache-tomcat-8580/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    cat /data/tools/apache-tomcat-8581/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    cat /data/tools/apache-tomcat-8582/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    cat /data/tools/apache-tomcat-8583/logs/catalina.`date --date='0 days ago' +%Y-%m-%d`.out | grep DateNewUser | awk '{FS=" "}{print $8,$9,$10,$11,$12}' >> /data/tools/`date --date='0 days ago' +%Y%m%d`.txt
    tar -zcvf `date --date='0 days ago' +%Y%m%d`.tar.gz `date --date='0 days ago' +%Y%m%d`.txt
    rm `date --date='0 days ago' +%Y%m%d`.txt

    s3cmd压缩前一天文件并上传

    s3cmd put `date --date='0 days ago' +%Y%m%d`.tar.gz s3://ngemobi/logs/gp_android_id/dt=`date --date='0 days ago' +%Y-%m-%d`/`date --date='0 days ago' +%Y%m%d`.tar.gz

     scp远程传输

    命令:scp -r bb.log ngsteam@52.74.22.232:/data/litao/
    密码:TKp*****@ac

  • 相关阅读:
    【Coursera】Third Week(2)
    【TCP/IP详解 卷一:协议】第二章:链路层
    【Coursera】Third Week(1)
    【Coursera】SecondWeek(2)
    【Coursera】SecondWeek(1)
    【Coursera】History: Dawn of Electronic Computing学后小结
    【TCP/IP详解 卷一:协议】第一章概论 学习笔记
    NS3 fifth.cc 拥塞窗口实例
    NS3 利用Gnuplot生成拥塞窗口例子fifth.cc的png图像
    C++小结:迟到的小结和重新起航的故事
  • 原文地址:https://www.cnblogs.com/beautiful-code/p/5748286.html
Copyright © 2020-2023  润新知