Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2019 17:33:35 +0100 (CET)
From:      =?UTF-8?Q?Trond_Endrest=C3=B8l?= <trond.endrestol@ximalas.info>
To:        =?UTF-8?Q?Trond_Endrest=C3=B8l?= <trond.endrestol@ximalas.info>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to convert svn repository change date to epoch timestamp?
Message-ID:  <alpine.BSF.2.21.99999.352.1911031732260.5571@enterprise.ximalas.info>
In-Reply-To: <alpine.BSF.2.21.99999.352.1911031724370.5571@enterprise.ximalas.info>
References:  <trinity-0e118d1a-6b7c-4c5e-a0b8-2b6fceb1e713-1572782605441@3c-app-gmx-bs36> <alpine.BSF.2.21.99999.352.1911031724370.5571@enterprise.ximalas.info>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Nov 2019 17:28+0100, Trond Endrestøl wrote:

> date -juf "%FT%TZ" `svnlite info --no-newline --show-item last-changed-date /usr/src | sed 's/\.[0-9]*Z$/Z/'` "+%s"

Even simpler:

date -juf "%FT%T" `svnlite info --no-newline --show-item last-changed-date /usr/src | sed 's/\.[0-9]*Z$//'` "+%s"

-- 
Trond.
From owner-freebsd-questions@freebsd.org  Sun Nov  3 16:48:05 2019
Return-Path: <owner-freebsd-questions@freebsd.org>
Delivered-To: freebsd-questions@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4625417A476
 for <freebsd-questions@mailman.nyi.freebsd.org>;
 Sun,  3 Nov 2019 16:48:05 +0000 (UTC) (envelope-from vas@sibptus.ru)
Received: from admin.sibptus.ru (admin.sibptus.ru
 [IPv6:2001:19f0:5001:21dc::10])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 475hgm0jnhz4Lk3
 for <freebsd-questions@freebsd.org>; Sun,  3 Nov 2019 16:48:03 +0000 (UTC)
 (envelope-from vas@sibptus.ru)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; 
 s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date;
 bh=VG/VpEsKB7EJqr8Z8nAoJwQXvAPfswtaHRSvgjDlick=; b=mzAiVnAmRLIjPVDTvdIQUkZjgM
 KPK6q5yCkUQQFwo90kq9C8CZyDVh61HEIjN0vTWkgIEywfY/UFPrIMFfQu8iDWBvJg59klBlZWA8Q
 WyvHoyoxHE4U4JNHCXoY0cSGeE596Drrtc4HVa9wSTfiRKELhbXSdnZAinN+qapHhQQk=;
Received: from vas by admin.sibptus.ru with local (Exim 4.92.3 (FreeBSD))
 (envelope-from <vas@sibptus.ru>) id 1iRJ2i-000D9n-H6
 for freebsd-questions@freebsd.org; Sun, 03 Nov 2019 23:47:56 +0700
Date: Sun, 3 Nov 2019 23:47:56 +0700
From: Victor Sudakov <vas@sibptus.ru>
To: freebsd-questions@freebsd.org
Subject: Re: grep for ascii nul
Message-ID: <20191103164756.GA50239@admin.sibptus.ru>
References: <20191101092716.GA67658@admin.sibptus.ru>
 <63808.1572638827@segfault.tristatelogic.com>
 <20191102064505.GA98558@admin.sibptus.ru>
 <7775e7f8-89ba-d057-67d3-cdcb92d2bbb4@panix.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH"
Content-Disposition: inline
In-Reply-To: <7775e7f8-89ba-d057-67d3-cdcb92d2bbb4@panix.com>
X-PGP-Key: http://admin.sibptus.ru/~vas/
X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9  3532 0DA4 F259 9B5E C634
User-Agent: Mutt/1.12.2 (2019-09-21)
X-Rspamd-Queue-Id: 475hgm0jnhz4Lk3
X-Spamd-Bar: --------
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=sibptus.ru header.s=20181118 header.b=mzAiVnAm;
 dmarc=pass (policy=none) header.from=sibptus.ru;
 spf=pass (mx1.freebsd.org: domain of vas@sibptus.ru designates
 2001:19f0:5001:21dc::10 as permitted sender) smtp.mailfrom=vas@sibptus.ru
X-Spamd-Result: default: False [-8.38 / 15.00]; ARC_NA(0.00)[];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 R_DKIM_ALLOW(-0.20)[sibptus.ru:s=20181118];
 FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx];
 TO_MATCH_ENVRCPT_ALL(0.00)[];
 MIME_GOOD(-0.20)[multipart/signed,text/plain];
 TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 RCPT_COUNT_ONE(0.00)[1];
 IP_SCORE(-3.28)[ip: (-9.84), ipnet: 2001:19f0:5000::/38(-4.92), asn:
 20473(-1.59), country: US(-0.05)]; 
 DKIM_TRACE(0.00)[sibptus.ru:+];
 DMARC_POLICY_ALLOW(-0.50)[sibptus.ru,none];
 SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[];
 MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:20473, ipnet:2001:19f0:5000::/38, country:US];
 RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 03 Nov 2019 16:48:05 -0000


--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Kurt Hackenberg wrote:
>=20
> > I'm a big fan of awk, awk is in the base system and should be able to do
> > it, right?
> >=20
> > $ hd trees.txt
> > 00000000  66 69 72 0a 6f 61 6b 0a  63 65 64 00 61 72 0a 62  |fir.oak.ce=
d.ar.b|
> > 00000010  69 72 63 68 0a 70 61 6c  6d 0a                    |irch.palm.|
> > 0000001a
> > $
> >=20
> > Note the ascii null embedded in the word "cedar"
> >=20
> > $ awk '/\x66\x69/{print $0}' trees.txt
> > fir
> >=20
> > So far so good. But with the ascii nul it behaves in an unexpected way:
> >=20
> > $ awk '/\x00/{print $0}' trees.txt
> > fir
> > oak
> > ced
> > birch
> > palm
> > $
>=20
> Looks like it has the same problem that I guess grep does: it takes that=
=20
> NUL as the end of a C string, so the regexp becomes a null string (zero=
=20
> length), which matches everything.

You know what, lang/gawk does not have this problem:

$ gawk '/\x00/{print $0}' trees.txt
cedar
$=20

This is not the first time BSD AWK sucks in comparison with GNU AWK :-(

Do you think this is worth a PR?

--=20
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

--7JfCtLOvnd9MIVvH
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJdvwS8AAoJEA2k8lmbXsY0iKkIAK6fkoIVfALQWfCuwxbO/wc0
YWI6+eQbefuTn+KgibgnfgkabMlYD96MUBpWtGnBmvNUV9tG63uX0OIoIl9XRdaT
B8j5KL6PsKUqrbsRFaBLNsNBeKryEutOb8LDVYTV9BRIsckz4Fa5rhKQrbePeosy
DudlEgWWY8yxHhk2xruiNQaa8jikPr0k4SMTlr/JyyQddosvEuTIPb+9vMh2fpJC
jEWfmsUlpLnZ0uMeBIMMRVHpyQAvJ3j04TJYRLoWAv1AZN5pp7tGEYpFvNXNPfIW
CKMwL9ZhkIj1rTE1wn/G+L1FRqrKaEx83SxlWrcXERhbWfQBvGecpaIz51jekUg=
=WQYM
-----END PGP SIGNATURE-----

--7JfCtLOvnd9MIVvH--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.21.99999.352.1911031732260.5571>