Add a --timestamp option to cat? (original) (raw)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Adam Sjøgren
Subject: Add a --timestamp option to cat?
Date: Thu, 03 Mar 2011 21:33:23 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

Hi.

I often have programs that output stuff I would like have logged with timestamps, but they don't print timestamps themselves. I have been using various shell-scripts/hacks calling date(1) to wrap them.

I think it would be really great to be able to just go:

$ some_program | cat --timestamp > some_program.log

Rather similar to what cat --number does, only with timestamps.

I have made a little patch adding that functionality in a topic-branch called "timestamp" in my local clone of the coreutils git-repository:

(git clone http://koldfront.dk/git/coreutils will clone my repo.)

Example:

$ (echo A; sleep 2; echo B; sleep 3; echo C) | ./cat --timestamp 2011-03-03 21:30:19 A 2011-03-03 21:30:21 B 2011-03-03 21:30:24 C $ (echo A; echo B; echo C) | ./cat --number 1 A 2 B 3 C $

I was wondering whether something like this could be considered for inclusion, or if there is some other/better avenue I should pursue?

Any advice/comments/etc. welcome. Thanks!

Best regards,

Adam

-- "I always liked songs with parentheses in the title." Adam Sjøgren address@hidden