Mailinglist Archive: opensuse (1986 mails)

< Previous Next >
[opensuse] Timestamping pipe [Was: Attempting (and succeeding) to use my UPS]
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Fri, 21 Nov 2008 02:18:25 +0100 (CET)
  • Message-id: <alpine.LSU.2.00.0811210213420.5568@xxxxxxxxxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Thursday, 2008-11-20 at 16:41 -0800, Randall R Schulz wrote:
On Thursday 20 November 2008 16:30, Carlos E. R. wrote:

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...

Not possible? I was considering of programming it myself, it would be quite short. I'd do it on pascal, probably. I was just wondering if it existed.


Still...

tstamp:

-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
#!/bin/bash --norc

tsFormat='%F_%H.%M.%S'

IFS=
while read line; do
echo "$(date +"$tsFormat: $line")"
done
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-

See? Not that difficult :-)


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.

The one most usefull to me would be time since command start.

- -- Cheers,
Carlos E. R.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkkmDGIACgkQtTMYHG2NR9VOvQCeP4898y3MG3vYKtN18FScZ3ox
cw0AnRFPbmaDvIP6BrlmmjIx//NHcRLv
=zzzB
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >