• bash计算上下行数据差值


    for i in {1..60000}; do echo "`date +'%F %T'` `df /dev/md0 | grep 'data1'` "; sleep 1; done | awk '{a[NR]=$6; print $0,a[NR]-a[NR-1]}'

    [root@TENCENT64 ~]# for i in {1..60000}; do echo "`date +'%F %T'` `df /dev/md0 | grep 'data1'` "; sleep 1; done | awk '{a[NR]=$6; print $0,a[NR]-a[NR-1]}'
    2018-11-22 20:11:20 /dev/md0 6976558760 5146898460 1478037340 78% /data1 1478037340
    2018-11-22 20:11:21 /dev/md0 6976558760 5146898460 1478037340 78% /data1 0
    2018-11-22 20:11:22 /dev/md0 6976558760 5146918940 1478016860 78% /data1 -20480
    2018-11-22 20:11:23 /dev/md0 6976558760 5146927148 1478008652 78% /data1 -8208
    2018-11-22 20:11:24 /dev/md0 6976558760 5146931256 1478004544 78% /data1 -4108
    2018-11-22 20:11:25 /dev/md0 6976558760 5146943560 1477992240 78% /data1 -12304
    2018-11-22 20:11:26 /dev/md0 6976558760 5146947656 1477988144 78% /data1 -4096
    2018-11-22 20:11:27 /dev/md0 6976558760 5146951752 1477984048 78% /data1 -4096
    2018-11-22 20:11:28 /dev/md0 6976558760 5146968136 1477967664 78% /data1 -16384
    2018-11-22 20:11:29 /dev/md0 6976558760 5146972232 1477963568 78% /data1 -4096
    2018-11-22 20:11:30 /dev/md0 6976558760 5146988848 1477946952 78% /data1 -16616
    2018-11-22 20:11:31 /dev/md0 6976558760 5146996808 1477938992 78% /data1 -7960
    2018-11-22 20:11:32 /dev/md0 6976558760 5147009096 1477926704 78% /data1 -12288
    2018-11-22 20:11:33 /dev/md0 6976558760 5147009096 1477926704 78% /data1 0
    2018-11-22 20:11:34 /dev/md0 6976558760 5147017288 1477918512 78% /data1 -8192
    2018-11-22 20:11:35 /dev/md0 6976558760 5147029576 1477906224 78% /data1 -12288
    2018-11-22 20:11:36 /dev/md0 6976558760 5147033672 1477902128 78% /data1 -4096
    2018-11-22 20:11:37 /dev/md0 6976558760 5147037772 1477898028 78% /data1 -4100
    2018-11-22 20:11:38 /dev/md0 6976558760 5147045964 1477889836 78% /data1 -8192
    2018-11-22 20:11:39 /dev/md0 6976558760 5147066444 1477869356 78% /data1 -20480
    2018-11-22 20:11:40 /dev/md0 6976558760 5147070540 1477865260 78% /data1 -4096
    2018-11-22 20:11:41 /dev/md0 6976558760 5147074636 1477861164 78% /data1 -4096
    2018-11-22 20:11:42 /dev/md0 6976558760 5147091020 1477844780 78% /data1 -16384
    2018-11-22 20:11:43 /dev/md0 6976558760 5147099212 1477836588 78% /data1 -8192

    只看某个文件的变化:

    for i in {1..60000}; do echo "`date +'%F %T'` `ls -l access_log.181124` "; sleep 1; done | awk '{a[NR]=$7; print $0,a[NR]-a[NR-1]}'

  • 相关阅读:
    JS日期选择器
    兼容多种浏览器的Ctrl+Enter提交兼容firefox、ie、opera
    在线播放器 在网页中插入MediaPlayer 兼容IE和FF的代码调试
    Android客户端开发即WebView组件的使用详解
    web开发时碰到的问题以及心得经验
    Select的OnChange()事件
    iPhone 浏览器开发之关键 UIWebView
    获取css样式表内样式的js函数currentStyle(IE),defaultView(FF)
    利用XMLHTTP无刷新添加数据之Get篇
    客户端表单通用验证checkForm(oForm) js版
  • 原文地址:https://www.cnblogs.com/zejin2008/p/10003624.html
Copyright © 2020-2023  润新知