summaryrefslogtreecommitdiff
path: root/ts
diff options
context:
space:
mode:
authorjoeyh <joeyh>2006-02-19 19:18:31 +0000
committerjoeyh <joeyh>2006-02-19 19:18:31 +0000
commit4f1ebf7b7771af3244da916be4c6cbb33deb92d0 (patch)
tree0c80b37b878e670051554c3c2c995a2a8f5054f5 /ts
parented168d654253279014143df3aa3c27e436cd3930 (diff)
downloadmoreutils-4f1ebf7b7771af3244da916be4c6cbb33deb92d0.tar.gz
add
Diffstat (limited to 'ts')
-rwxr-xr-xts37
1 files changed, 37 insertions, 0 deletions
diff --git a/ts b/ts
new file mode 100755
index 0000000..42a1ce4
--- /dev/null
+++ b/ts
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+ts - timestamp input
+
+=head1 SYNOPSIS
+
+ts [format]
+
+=head1 DESCRIPTION
+
+ts adds a timestamp to the beginning of each line of input
+
+The optional format parameter controls how the timestamp is formatted,
+as used by L<strftime(3)>. The default format is "%H:%M:%S".
+
+=head1 AUTHOR
+
+Copyright 2006 by Joey Hess <joey@kitenet.net>
+
+Licensed under the GNU GPL.
+
+=cut
+
+use warnings;
+use strict;
+use POSIX q{strftime};
+
+my $format="%H:%M:%S";
+$format=shift if @ARGV;
+
+$|=1;
+
+while (<>) {
+ print strftime($format, localtime)." ".$_;
+}