psilandia

logo

Pasi Savolainen

This is my site. It's ordered mainly in a 'directory' fashion. To navigate, use:

Specifics about me.

Timestamping standard input

I was a bit surprized to learn that there is no timestamping tool for standard input in UNIX. So I wrote one.

It takes a parameter, which is in a format that 'strftime(3)' -function understands ('date --help' will show you a quick cheatsheet :). Then it takes all standard input (STDIN) and outputs those lines prepended with timestamp determined by parameter.

Example:

# default is "%H:%M:%S ", which outputs "HH:MM:SS "
$ du -hcs linux-2.6.3/ mm41/ | timestamp
22:51:56 213M   linux-2.6.3
22:52:00 82M    mm41
22:52:00 295M   total

# some other timestamp format
/usr$ du -hcs bin/ share/ include/ lib/ | timestamp "%x %X - "
03/07/04 22:54:34 - 219M        bin
03/07/04 22:58:33 - 1.7G        share
03/07/04 22:58:41 - 43M include
03/07/04 22:59:25 - 1.2G        lib
03/07/04 22:59:25 - 3.1G        total

Download timestamp-1.0.tar.bz2, unpack (tar xvjf timestamp-1.0.tar.bz2) and 'make'. Place resulting binary in path.

(4½ years ago) | /code/misc/timestamp | Comments 0

Comments:

Check HTML and CSS Validity. RSS feed Rendertime: 0.65s