[Top][All Lists]

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

Add a --timestamp option to cat?

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)


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 will clone my repo.)


  $ (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,


 "I always liked songs with parentheses in the title."        Adam Sjøgren

reply via email to

[Prev in Thread] Current Thread [Next in Thread]