#!/usr/bin/perl #timestamp.pl ### use Time::HiRes qw(gettimeofday); $|=1; while (<>) { $timestamp = sprintf("%d.%06d", gettimeofday()); print "$timestamp $_"; } exit; --- touch testfile tail -f testfile | timestamp.pl _in another window_ echo 'test' >> testfile (wait a while) echo 'test' >> testfile (wait a few seconds) echo 'test' >> testfile (wait a little while) echo 'test' >> testfile