memo.xight.org

/ / memo.xight.org

2005-12-09

入力行に時刻を付けて吐き出すフィルタ

- Source
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qq(strftime);
$| = 1;
while (defined(my $line = <>)) {
	print strftime('%Y/%m/%d %H:%M:%S ', localtime), $line;
}

- Usage

% ping localhost | puttime
2005/12/09 02:16:08 PING localhost (127.0.0.1): 56 data bytes
2005/12/09 02:16:08 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.0 ms
2005/12/09 02:16:09 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.0 ms
2005/12/09 02:16:10 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.0 ms
2005/12/09 02:16:11 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.0 ms
2005/12/09 02:16:12 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.0 ms

- Reference
スペースモラトリアムノカミサマ - 2005-12-05 - 入力行に時刻を付けて吐き出すフィルタ
http://pmakino.jp/tdiary/20051205.html#p01
- via
cl.pocari.org - 2005-12-06 - 入力行に時刻を付けて吐き出すフィルタ
http://cl.pocari.org/2005-12-06-7.html

カテゴリ: [Perl]
2005-12 /

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-12-02 10:52
Copyright © 2005 xight.org All Rights Reserved.