[ale] line timestamp command

Scott Plante splante at insightsys.com
Tue Nov 12 15:14:44 EST 2013


Thanks, yes that's pretty much what I was after. And you're right--not so convenient. I guess he did it that way so the conversion to local format wouldn't make the timestamp go off by too many nanoseconds. I don't really need that level of precision, but it'll work. I'm not sure if I'll try it or just keep my little script. Thanks all the same though. It looks like there are some other interesting tools on that site too. 


Scott 

----- Original Message -----

From: "Ed Cashin" <ecashin at noserose.net> 
To: "Atlanta Linux Enthusiasts" <ale at ale.org> 
Sent: Tuesday, November 12, 2013 2:58:03 PM 
Subject: Re: [ale] line timestamp command 


I do happen to know of one, but it's by Dan J. Bernstein. That sometimes means it's of uncommonly high quality and careful design but low user convenience. 


Usually the resolution is to do everything the way DJB thinks things should be done. Then it's convenient and reliable. But it requires the user to adjust behavior and/or expectations. In this case, tai64n does what you ask for, but the timestamp is not probably anything you'd want to read. So tai64nlocal converts it. Weird, but not carelessly designed. 


http://cr.yp.to/daemontools/tai64n.html 

http://cr.yp.to/daemontools/tai64nlocal.html 






On Tue, Nov 12, 2013 at 1:34 PM, Scott Plante < splante at insightsys.com > wrote: 




Does anyone happen to know of a command line tool that will read lines from standard input and write them to std out, pre-pending a timestamp? I have a process that emits messages to std out periodically as it processes and I'd like to write that to a log file, but with a time at the start of the line. I could do it with a script but a nice little command would be better, if it exists. 


I'm looking for something that would perform the function of this script, maybe with an option for format: 


while read line; 
do 
echo $(date +"%D %T") "$line"; 
done 



Scott 

_______________________________________________ 
Ale mailing list 
Ale at ale.org 
http://mail.ale.org/mailman/listinfo/ale 
See JOBS, ANNOUNCE and SCHOOLS lists at 
http://mail.ale.org/mailman/listinfo 







-- 
Ed Cashin < ecashin at noserose.net > 
http://noserose.net/e/ 
http://www.coraid.com/ 
_______________________________________________ 
Ale mailing list 
Ale at ale.org 
http://mail.ale.org/mailman/listinfo/ale 
See JOBS, ANNOUNCE and SCHOOLS lists at 
http://mail.ale.org/mailman/listinfo 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131112/795f414c/attachment.html>


More information about the Ale mailing list