----- Original Message -----
From: "Randall R Schulz"
On Thursday 20 November 2008 16:30, Carlos E. R. wrote:
On Thursday, 2008-11-20 at 18:03 -0500, Patrick Shanahan wrote:
Of course, the root problem is why is it so slow. Can you imagine a one minute delay on every boot?
That is *wierd* :^). It must be the ups unit is slow to communicate.
No, not that. Once it gets going it prints a message about every five seconds, if you start the driver on console. response to commands is fast. It must be one of the commands or initial tests that fail. I'll think that out some other day.
Do you know of a pipe program that precedes every line with a time stamp?
No such thing exists, nor is it even remotely possible...
Still...
tstamp:
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- #!/bin/bash --norc
tsFormat='%F_%H.%M.%S'
IFS= while read line; do echo "$(date +"$tsFormat: $line")" done -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
Adjust the tsFormat variable to create the time-stamp you want. The "date" command has many, many options. Check the help output or the man page.
Unecessary sub-shell spwan. I don't see the point in unsetting IFS either. And I'm not sure putting the format string into a variable actually simplifies things. I end up with just one line and no spawned child shell. ---top--- #!/bin/bash --norc while read ;do date "+%F_%H.%M.%S: $REPLY" ;done ---end--- Though really I would suggest this in order to handle the last line of input if input ends without a final linefeed. ---top--- #!/bin/bash --norc DONE=false until $DONE ;do read || DONE=true date "+%Y%m%d%H%M%S: $REPLY" done ---end--- Except, even better than that, why run the date command over and over when other scripting languages have a date call built-in. Now we really only have one process, not even a shell plus date starting and exiting over and over, we just have one single awk: awk '{print strftime("%Y%m%d%H%M%S: ")$0}' or ---top--- #!/usr/bin/awk -f { print strftime("%Y%m%d%H%M%S: ")$0 } ---end--- There is also the logger command which does this already if you don't mind the output going to syslog or to a file configured by syslog.conf -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org