Register
It is currently Wed Oct 22, 2014 12:24 am

Inserting date/time into piped data


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Sep 09, 2010 6:25 pm   

Joined: Thu Oct 09, 2008 3:26 am
Posts: 15
Location: Columbus, OH
I'm pulling control data off of a radio with a usb interface and I'd like to timestamp the entries coming off the minicom program.

Data flow from minicom:

MOT,30B,1,261C
MOT,3C0,0,52C0
MOT,3C0,0,308F
MOT,32B,1,232E
MOT,2A9,0,2A70
MOT,3C0,0,52C0
MOT,3C0,0,308F
MOT,32B,1,232E
MOT,2A9,0,2A70
MOT,3C0,0,52C0

desired output:

09/07/10 14:28:03 MOT,30B,1,261C
09/07/10 14:28:03 MOT,3C0,0,52C0
09/07/10 14:28:04 MOT,3C0,0,308F
09/07/10 14:28:04 MOT,32B,1,232E
09/07/10 14:28:05 MOT,2A9,0,2A70
09/07/10 14:28:06 MOT,3C0,0,52C0
09/07/10 14:28:06 MOT,3C0,0,308F
09/07/10 14:28:06 MOT,32B,1,232E
09/07/10 14:28:07 MOT,2A9,0,2A70
09/07/10 14:28:09 MOT,3C0,0,52C0

how do I intercept the output and insert the date and time?

Thanks all !!!


Top
 Profile  
 PostPosted: Thu Sep 09, 2010 10:48 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
try piping it through this:
Code:
awk '{ print strftime("%d/%m/%y %T"), $0; }'


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP