首页 > 其他 > 详细

awk显示ping时间

时间:2019-07-26 16:20:09      阅读:291      评论:0      收藏:0      [点我收藏+]
  • awk显示ping的时间
    ping 127.0.0.1 | awk ‘{ print $0"\t" strftime("%Y-%m-%d %H:%M:%S",systime()) }‘
  • 注释:
    \t //换行字符
    $0 //打印整行
    {print $0 "\t"} //逐行打印
    strftime()//时间函数。一般配合系统时间函数systime()使用
    strftime("%Y-%m-%d %H:%M:%S",systime()) //打印系统时间

    1. busybox

    [root@master1 ~]#docker service create --name busybox3 --replicas=3 busybox ping baidu.com
    [root@master1 ~]# docker service logs busybox3 -f -t
    技术分享图片

    awk显示ping时间

    原文:https://blog.51cto.com/13354560/2423863

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
    © 2014 bubuko.com 版权所有
    打开技术之扣,分享程序人生!