From owner-freebsd-questions@freebsd.org Sun Nov 3 16:33:44 2019 Return-Path: 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 30E11179BF8 for ; Sun, 3 Nov 2019 16:33:44 +0000 (UTC) (envelope-from trond.endrestol@ximalas.info) Received: from enterprise.ximalas.info (enterprise.ximalas.info [IPv6:2001:700:1100:1::8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ximalas.info", Issuer "Hostmaster ximalas.info" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 475hMC3pxDz4KfB for ; Sun, 3 Nov 2019 16:33:43 +0000 (UTC) (envelope-from trond.endrestol@ximalas.info) Received: from enterprise.ximalas.info (Ximalas@localhost [127.0.0.1]) by enterprise.ximalas.info (8.15.2/8.15.2) with ESMTPS id xA3GXax2018080 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 3 Nov 2019 17:33:36 +0100 (CET) (envelope-from trond.endrestol@ximalas.info) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ximalas.info; s=default; t=1572798816; bh=QgVJVvN8Q3YfYlMIdn2Z6gk27k0FeFy0w2UWBiGP7aE=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=Zb4DzO4Ke5PEGJlODHo+sMFO2j01bstagFoXY4GiSjRFN/9tA9JJJnukdEOAhZIxa XSGe0dS22Vyb37/deKPR/7TOZI/YNXgwbWe57zSkwT9//cDgf98GOo5oFELPc5yzUI LMfpvTmX0QX5CL4mcEJKFUVQPvK0Ua4Rgapsw/TFxcZqQ1QCHg21EBHimoJXMad2wu LKp3yuhLQGa9Q2lokAwRd3/3Oxy4LXn3nSE/QdLTLBKbjebykV6pch2cy91qy5FfCy vAUKJphK1Y7hIBu4nMwNasv4TVs6lI5L6dBvVTE9xzbaTuqIFUfE7jenFBXpu6g+Hu ZK0VUCnxAe94Q== Received: from localhost (trond@localhost) by enterprise.ximalas.info (8.15.2/8.15.2/Submit) with ESMTP id xA3GXZj3018058; Sun, 3 Nov 2019 17:33:35 +0100 (CET) (envelope-from trond.endrestol@ximalas.info) X-Authentication-Warning: enterprise.ximalas.info: trond owned process doing -bs Date: Sun, 3 Nov 2019 17:33:35 +0100 (CET) From: =?UTF-8?Q?Trond_Endrest=C3=B8l?= Sender: Trond.Endrestol@ximalas.info To: =?UTF-8?Q?Trond_Endrest=C3=B8l?= cc: freebsd-questions@freebsd.org Subject: Re: How to convert svn repository change date to epoch timestamp? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.99999 (BSF 352 2019-06-22) OpenPGP: url=http://ximalas.info/about/tronds-openpgp-public-key MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on enterprise.ximalas.info X-Rspamd-Queue-Id: 475hMC3pxDz4KfB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ximalas.info header.s=default header.b=Zb4DzO4K; dmarc=pass (policy=none) header.from=ximalas.info; spf=pass (mx1.freebsd.org: domain of trond.endrestol@ximalas.info designates 2001:700:1100:1::8 as permitted sender) smtp.mailfrom=trond.endrestol@ximalas.info X-Spamd-Result: default: False [-2.91 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[ximalas.info:s=default]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; HAS_XAW(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[ximalas.info:+]; CTYPE_MIXED_BOGUS(1.00)[]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[ximalas.info,none]; IP_SCORE(-1.91)[ip: (-7.71), ipnet: 2001:700::/32(-1.18), asn: 224(-0.64), country: NO(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:224, ipnet:2001:700::/32, country:NO]; SUBJECT_ENDS_QUESTION(1.00)[] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 16:33:44 -0000 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: 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 ; 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 ; 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 ) 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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--