little perl script to insert a timestamp to start of each line

This script will insert a timestamp at the start of each line you feed it.

Example use: vmstat 1 | ./insert_timestamp.pl

— cut here —
#!/usr/bin/perl

# insert a timestamp into the data stream

use POSIX strftime;

while ($_ = ) {

print strftime (“%d%b%Y-%H:%M:%St”,localtime(time()));
print $_;
}
— cut here —