免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: jhgzzq
打印 上一主题 下一主题

如何在ping 命令结果前面加上时间日期!!! [复制链接]

论坛徽章:
0
21 [报告]
发表于 2005-09-20 12:29 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

[quote]原帖由 \"slash001\"][/quote 发表:\n\r\nunix下C编程也会,老弟全才啊, 就差Java的了 \r\n你让俺看到了中国软件的希望啊,哈哈

论坛徽章:
0
22 [报告]
发表于 2005-09-20 13:23 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

呵呵,我不是做开发的,就会简单的瞎写点,见笑了

论坛徽章:
0
23 [报告]
发表于 2005-09-20 13:50 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

呵呵,做管理的都会瞎写点就很难得了

论坛徽章:
0
24 [报告]
发表于 2005-09-20 15:25 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

如果是在 Linux 下面,可以这样\r\n
  1. \r\n# while :;do ping -c 1 172.17.39.251|awk \'/ttl=/\'|sed \"s/^/`date +%Y-%m-%d\\|%T` /\";sleep 1;done\r\n
复制代码
\r\n\r\n\r\n显示效果如下\r\n
\r\n[root@PT_LINUX boot]# while :;do ping -c 1 172.17.39.251|awk \'/ttl=/\'|sed \"s/^/`date +%Y-%m-%d\\|%T` /\";sleep 1;done\r\n2005-09-20|15:24:40 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.240 ms\r\n2005-09-20|15:24:41 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.235 ms\r\n2005-09-20|15:24:42 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.220 ms\r\n2005-09-20|15:24:43 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.224 ms\r\n2005-09-20|15:24:45 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.211 ms\r\n2005-09-20|15:24:46 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.211 ms\r\n2005-09-20|15:24:47 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.222 ms\r\n2005-09-20|15:24:48 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.221 ms\r\n2005-09-20|15:24:49 64 bytes from 172.17.39.251: icmp_seq=0 ttl=128 time=0.222 ms\r\n\r\n[root@PT_LINUX boot]#\r\n

论坛徽章:
0
25 [报告]
发表于 2005-09-26 08:48 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

我想请问一下为什么在我的机子上这个命令不行呢

论坛徽章:
0
26 [报告]
发表于 2005-09-26 23:27 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

[quote]原帖由 \"slash001\"][/quote 发表:\n\r\n\r\ncool!

论坛徽章:
1
2015元宵节徽章
日期:2015-03-06 15:50:39
27 [报告]
发表于 2005-09-28 22:09 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

哪位高手可以将tping.vbs更改一下,可以自己设定ip和一些参数?\r\n比如cscript tping.vbs 192.168.1.1 -t -l 1000\r\n那就完美了。

论坛徽章:
0
28 [报告]
发表于 2005-09-30 10:01 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

  1. \r\nDim args, flag, unsuccOut\r\nargs=\"\"\r\notherout=\"\"\r\nflag=0\r\n\r\nIf WScript.Arguments.count = 0 Then\r\n        WScript.Echo \"Usage: cscript tping.vbs [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]\"\r\n        WScript.Echo \"                         [-s count] [[-j host-list] | [-k host-list]]\"\r\n        WScript.Echo \"                         [-r count] [-w timeout] destination-list\"\r\n        wscript.quit\r\nEnd if\r\n\r\nFor i=0 to WScript.Arguments.count - 1\r\n        args=args & \" \" & WScript.Arguments(i)\r\nNext\r\n\r\nSet shell = WScript.CreateObject(\"WScript.Shell\") \r\nSet re=New RegExp \r\nre.Pattern=\"^Reply|^Request\" \r\nSet myping=shell.Exec(\"ping\" & args)\r\n\r\nwhile Not myping.StdOut.AtEndOfStream \r\n   strLine=myping.StdOut.ReadLine() \r\n   r=re.Test(strLine) \r\n   If r Then \r\n        WScript.Echo date & \" \"& time & chr(9) & strLine\r\n        flag=1\r\n   Else\r\n        unsuccOut=unsuccOut & strLine\r\n   End if \r\nWend\r\n\r\nif flag = 0 then\r\n        WScript.Echo unsuccOut\r\nend if\r\n
复制代码
\r\n\r\nE:\\>;cscript tping.vbs 192.168.0.249 -t -l 1000\r\nMicrosoft (R) Windows Script Host Version 5.6\r\n版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。\r\n\r\n2005-9-30 10:03:29      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:30      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:31      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:32      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:33      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:34      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:35      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64\r\n2005-9-30 10:03:36      Reply from 192.168.0.249: bytes=1000 time<10ms TTL=64

论坛徽章:
0
29 [报告]
发表于 2005-10-08 16:13 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

   \r\nzzzzzz

论坛徽章:
0
30 [报告]
发表于 2005-10-10 09:51 |只看该作者

如何在ping 命令结果前面加上时间日期!!!

slash001的方法很不错罗!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP