Re: [opensuse] Timestamping pipe
So, that silly time-stamp logger thingie ended up becoming a bug in my brain that wouldn't rest until I made it into an actual useful script that could do both of the types of time-stamping mentioned so far. Plus, the "time since program start" idea made me realise yet a 3rd way to count that someone might want in some cases, "time-since-last-event". So here is an awk script that takes an optional command line arg "mode=s" or "mode=l" and can do any of above depending on mode=x if no mode=x specified, it's the same as mode=a , since I think thats the most commonly expected form of timestamping. In all cases it's very lightweight, no extra processes, and only awk (which is a lot lighter than say, perl. I reduced the number of digits in the days from 4 to 3, to eliminate the misleading appearance that it's the year in there. That still allows for 2.73 years of continuous operation. heh. Sample runs showing each mode: whoa:~ $ (echo this ;sleep 4 ;echo is ;sleep 3 ;echo a ;sleep 1 ;echo test) |tscat 20081121011128: this 20081121011132: is 20081121011135: a 20081121011136: test whoa:~ $ (echo this ;sleep 4 ;echo is ;sleep 3 ;echo a ;sleep 1 ;echo test) |tscat mode=s 000:00:00:00: this 000:00:00:04: is 000:00:00:07: a 000:00:00:08: test whoa:~ $ (echo this ;sleep 4 ;echo is ;sleep 3 ;echo a ;sleep 1 ;echo test) |tscat mode=l 000:00:00:00: this 000:00:00:04: is 000:00:00:03: a 000:00:00:01: test whoa:~ $ And the script: whoa:~ $ cat bin/tscat #!/usr/bin/awk -f # tscat - time-stamp cat # Use like "cat". # Copies stdin to stdout with a timestamp prepended to each line. # Options: # mode=a absolute system time (default) "yyyymmddhhmmss: input-text..." # mode=s elapsed since start "ddd:hh:mm:ss: input-text..." # mode=l elapsed since last line "ddd:hh:mm:ss: input-text..." # # myprogram |tscat (same as "myprogram |tscat mode=a") # myprogram |tscat mode=s # tscat =60) { m=s/60 ; s%=60 } if (m>=60) { h=m/60 ; m%=60 } if (h>=24) { d=h/24 ; h%=24 } printf ("%03i:%02i:%02i:%02i: %s\n",d,h,m,s,$0) } (mode=="l"){ S=systime() } whoa:~ $ -- 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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2008-11-21 at 01:43 -0500, Brian K. White wrote:
So, that silly time-stamp logger thingie ended up becoming a bug in my brain that wouldn't rest until I made it into an actual useful script that could do both of the types of time-stamping mentioned so far. Plus, the "time since program start" idea made me realise yet a 3rd way to count that someone might want in some cases, "time-since-last-event".
:-)
So here is an awk script that takes an optional command line arg "mode=s" or "mode=l" and can do any of above depending on mode=x if no mode=x specified, it's the same as mode=a , since I think thats the most commonly expected form of timestamping. In all cases it's very lightweight, no extra processes, and only awk (which is a lot lighter than say, perl.
Ha, but my pascal binary is lighter :-p Now you need to create the man and info pages... (ducking and running)
I reduced the number of digits in the days from 4 to 3, to eliminate the misleading appearance that it's the year in there. That still allows for 2.73 years of continuous operation. heh.
Wow. I'll have to save all these emails for possible later use :-) - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkmk54ACgkQtTMYHG2NR9WXpQCeLkZwdsOQsM9Fy1Y1Qh0bA4lq nSUAnRR/G0bSnX+k1p5qVKRhiuKDSuz3 =oXFt -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 21 November 2008 02:55, Carlos E. R. wrote:
...
Ha, but my pascal binary is lighter :-p
Pascal is dead. Please stop poking the corpse.
Now you need to create the man and info pages...
...
-- Cheers, Carlos E. R.
You might want to look at the "watch" program. It's not really what you're looking for, but it's good to know about in the general area of monitoring long-running programs. Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Friday 21 November 2008 02:55, Carlos E. R. wrote:
...
Ha, but my pascal binary is lighter :-p
Pascal is dead. Please stop poking the corpse.
Yep, we all use Fortran now! ;-) I took a Pascal course, back in the mid 80's. It was my first exposure to structured programming. I liked working in it, as it was much better than BASIC. I have also taken courses for BASIC, Fortran, C and also some assembly programming for 6502 & 6809 CPUs. -- Use OpenOffice.org http://www.openoffice.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2008-11-21 at 05:42 -0800, Randall R Schulz wrote:
On Friday 21 November 2008 02:55, Carlos E. R. wrote:
...
Ha, but my pascal binary is lighter :-p
Pascal is dead. Please stop poking the corpse.
You are mistaken, it is very alive. Codename: Lazarus, a Delphi lookalike, but multiplatform and free.
You might want to look at the "watch" program. It's not really what you're looking for, but it's good to know about in the general area of monitoring long-running programs.
Yes, I know it. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkm5GwACgkQtTMYHG2NR9UMXgCghU0IP6UpBKEOKL7dk5pdkbhn eMkAnRNVIxc0IQoeRPMiMfMRI8oVbYCg =sxcw -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Carlos E. R. wrote:
On Friday, 2008-11-21 at 05:42 -0800, Randall R Schulz wrote:
On Friday 21 November 2008 02:55, Carlos E. R. wrote:
...
Ha, but my pascal binary is lighter :-p
Pascal is dead. Please stop poking the corpse.
You are mistaken, it is very alive. Codename: Lazarus, a Delphi lookalike, but multiplatform and free.
An interesting heads up, thanks, wrote a pile of Pascal stuff a long time ago, as a language was good to work with ... (umm... location?, prefer to not to get swamped with biblical and Robert Heinlien references when googling :-) ?). - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkknA10ACgkQasN0sSnLmgL/DwCgtNVncE9Ms6DseUcXj/G2tC/V bVAAnjh6I81n9TNlkai5rfxQFKSnEG+9 =vH93 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* G T Smith
An interesting heads up, thanks, wrote a pile of Pascal stuff a long time ago, as a language was good to work with ... (umm... location?, prefer to not to get swamped with biblical and Robert Heinlien references when googling :-) ?).
first choice: sourceforge.net -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2008-11-21 at 18:52 -0000, G T Smith wrote:
You are mistaken, it is very alive. Codename: Lazarus, a Delphi lookalike, but multiplatform and free.
An interesting heads up, thanks, wrote a pile of Pascal stuff a long time ago, as a language was good to work with ... (umm... location?, prefer to not to get swamped with biblical and Robert Heinlien references when googling :-) ?).
Heinlein too? X-) http://www.lazarus.freepascal.org/ But the site is not working right now - ah, its back. I have "lazarus-0.9.26-0...rpm" installed. Download from sourceforge: http://sourceforge.net/project/showfiles.php?group_id=89339. Compiling the source is complex, better get the binary rpm. However, you need the source tree of the compiler for some things. Screenshots here: http://wiki.lazarus.freepascal.org/Screenshots (And Heinlein's Lazarus: http://en.wikipedia.org/wiki/Lazarus_Long) There is another version of pascal, one that crosscompiles via gcc. I don't like and don't use it, not very compatible with turbopascal. Both this and freepascal where included with suse not too long ago. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkknIW4ACgkQtTMYHG2NR9U0EACdEz6a2aOO0Xd/azGjLwgOOEAl U60AoJEtB+b16kfXZhjM8/izD6NbqIss =Lwio -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Carlos E. R. wrote:
http://www.lazarus.freepascal.org/
But the site is not working right now - ah, its back. I have "lazarus-0.9.26-0...rpm" installed. Download from sourceforge: http://sourceforge.net/project/showfiles.php?group_id=89339. Compiling the source is complex, better get the binary rpm. However, you need the source tree of the compiler for some things. Screenshots here: http://wiki.lazarus.freepascal.org/Screenshots
(And Heinlein's Lazarus: http://en.wikipedia.org/wiki/Lazarus_Long)
There is another version of pascal, one that crosscompiles via gcc. I don't like and don't use it, not very compatible with turbopascal. Both this and freepascal where included with suse not too long ago.
I was not overly impressed with those either, for me it is more a bit of programming nostalgia, I think I have some old (+15 years) things which I might be able to resurrect (if I can find them after this time). Thanks for this and the extras :-), - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkkn5IoACgkQasN0sSnLmgLilACfUDtfYAmDUak0dtm9t7r2TAdE b+kAn3g81UwkqmBNOeeztjVds2+U7o6A =fKoL -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2008-11-22 at 10:52 -0000, G T Smith wrote:
I was not overly impressed with those either, for me it is more a bit of programming nostalgia, I think I have some old (+15 years) things which I might be able to resurrect (if I can find them after this time).
Thanks for this and the extras :-),
Welcome! I find easier resurrecting my pascal skills that learn new ones with awk, perl, or whatever. C? Mmmm... Posibly, but I prefer going against the tide in this ;-p Lazarus is a quite a nice IDE. However, if you haven't ever used Delphi, the tutorial is lacking: it is reading text, not a cute interactive teacher. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkn8E0ACgkQtTMYHG2NR9UN7wCaA7BfUTsfVRl+lmw1fvOglw4/ 9mYAnRHB4QDl36VP9CniyiGHzVQ++mEE =3ndT -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Brian K. White
-
Carlos E. R.
-
G T Smith
-
James Knott
-
Patrick Shanahan
-
Randall R Schulz