Mailinglist Archive: opensuse (1470 mails)

< Previous Next >
Re: [opensuse] What is the meaning of these firewall log entries?
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Sun, 14 Feb 2016 00:38:08 +0100 (CET)
  • Message-id: <alpine.LSU.2.20.1602140033460.7142@Grypbagne.inyvabe>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Saturday, 2016-02-13 at 19:50 +0100, Carlos E. R. wrote:

I need to code something first. I need a pipe that receives text entries, and
writes them to stdout prefixed with a timestamp.
I coded this years ago, but apparently I lost it. I know how to do it, just
that I wanted to avoid it.

I found it, but had to modify. In case it is useful for others, here goes:

program pipetimer2;

{$mode objfpc}{$H+}

uses
SysUtils;

Function StampNow (Fmt: string): AnsiString;
var S: AnsiString;
begin
DateTimeToString (S, Fmt, Now);
StampNow:= S;
end;

var
L: string;

begin
while not eof(input) do begin
readln(L);
writeln(StampNow('yyyy-mm-dd"T"hh:nn:ss.zzz'), ' ', L);
end
end.



Yes, pascal :-P


Sample run:

cer@Telcontar:~/bin/lazarus/mios> echo hello | ./pipetimer2
2016-02-14T00:37:25.890 hello
cer@Telcontar:~/bin/lazarus/mios>


- -- Cheers,
Carlos E. R.
(from 13.1 x86_64 "Bottle" at Telcontar)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iEYEARECAAYFAla/vmAACgkQtTMYHG2NR9V66wCeLq0XlBYt6vSv4Y/Me323Z87L
6wsAnjFW4ajKWhSPSXYlwtIGj2L8BRR/
=Z/wB
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups