Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gb-swatanabe/6239423 to your computer and use it in GitHub Desktop.
Save gb-swatanabe/6239423 to your computer and use it in GitHub Desktop.
$ ping x.x.x.x | ruby -rdate -pe 'BEGIN{$stdout.sync=true; trap(:INT){exit}}; print DateTime.now.strftime("\[%T\] ")'
@gb-swatanabe
Copy link
Author

出力はこのように:

[18:13:01] PING localhost (127.0.0.1): 56 data bytes
[18:13:01] 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.030 ms
[18:13:02] 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.054 ms
[18:13:03] 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.029 ms
[18:13:04] 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.031 ms
[18:13:05] 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.056 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment