[ale] line timestamp command
Derek Carter (aka goozbach)
goozbach at friocorte.com
Tue Nov 12 17:53:56 EST 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2013-11-12, 1334, Scott Plante 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
I wrote a bash library to do logging in my scripts which might be
worth a look:
https://github.com/goozbach/log4bats
- --
Derek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJSgrGEAAoJECcWlbcE84qz45oP/09sYJOUhA0KElNZWVFmLmNh
ovGGINxIIlEiNOnKifpYqpPpZP2pM6Mj43ctaX9ADvB42Jm4eDLdp9pZDPw2VqmS
+WDBrB9zOuPbCM7A41bvGTP7bMvgLvWt8p0xex9as5QZd7XbAwxYG48qOs6hNHvw
LhdtOfQeQBEd2/dYxouGQ7+F1Pi5CKSGuNHu6bIuBBwlYjqN+G/qClgt7UiFtR/y
WnU7rQsGRiZKXWRtAGBkfBl1UdbjfU8yejBaz72uA+rJ1GZ8agG4lpSzd9gzpbE1
wD6h0NaueAyFHFlwbClfiFZsemkJKCbdvpGmvaE6TjJVAJ8lnw2qpCJ9mEkm3BYi
mE72dT+okJwdZ7mdE6nnhQn1CR8wyPGpAkA5+eXDSti8YbKrO2RN/RnVAS1bjS6L
/EcKMGwLzEm2DY1ttWtIZJ5O7daqXwXakyupgmk6XUUpTgidRUD4QrOO2blCaHmv
s4DfON4QDVZQS8O5cGckNx5pBu5zWOwSHF813BSsxpQEgs0DsMC4QYneiRLy/o7w
yn4QaRjFj33dQgdaCWHDkLeLADvEuXE2vAY4xVbFoqrSe6DOuCPVpm9SnjVxtTXn
PWRA03FRJlhyAMZWnXtfnJBsLfdSU3DsWvvjiZ9PbzdGhzhNIL1tsqhIIKNDT+iU
+X01AgWTQGjBbZkwktgG
=4Zd+
-----END PGP SIGNATURE-----
More information about the Ale
mailing list