ping加时间戳
Linux: # 日期在后面 ping www.baidu.com | awk ‘{print $0″\t” strftime(“%F_%H:%M:%S”,systime());fflush()}’ 结果写入日志:nohup pingwww.baidu.com| awk ‘{print $0″\t” strftime(“%F_%H:%M:%S”,systime());fflush()}’ >>ping_result.log 2>&1 & # 日期在前面 ping www.baidu.com | awk ‘{print strftime(“%F_%H:%M:%S”,systime())”\t” $0;fflush()}’ 结果写入日志:nohup pingwww.baidu.com| awk ‘{print strftime(“%F_%H:%M:%S”,systime())”\t” $0;fflush()}’ >>ping_result.log 2>&1 & Windows: 打开 powershell,运行下面的命令: ping www.baidu.com -t | Foreach{“{0} – {1}” -f (Get-Date),$_} 结果写入日志:ping www.baidu.com -t | Foreach{“{0} – … Read more