diff options
author | joeyh <joeyh> | 2006-02-19 19:18:31 +0000 |
---|---|---|
committer | joeyh <joeyh> | 2006-02-19 19:18:31 +0000 |
commit | 4f1ebf7b7771af3244da916be4c6cbb33deb92d0 (patch) | |
tree | 0c80b37b878e670051554c3c2c995a2a8f5054f5 /ts | |
parent | ed168d654253279014143df3aa3c27e436cd3930 (diff) | |
download | moreutils-4f1ebf7b7771af3244da916be4c6cbb33deb92d0.tar.gz |
add
Diffstat (limited to 'ts')
-rwxr-xr-x | ts | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -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)." ".$_; +} |