Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2016 16:31:20 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: grep and anchoring
Message-ID:  <9fc6d5df-108b-5663-5a31-92ca915a9604@FreeBSD.org>
In-Reply-To: <362EE01F-4B49-4ADB-A3A6-43F852FFF87F@danieldk.eu>
References:  <20232C89-B821-41EC-9188-C2A19C679BD8@danieldk.eu> <20160626163411.d05f863e.freebsd@edvax.de> <362EE01F-4B49-4ADB-A3A6-43F852FFF87F@danieldk.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Mx7clcHsOgU5K57EMCdXS3BqKKPefVEU5
Content-Type: multipart/mixed; boundary="sW8TwXFtt3AOEitUhmr2kcME38IwPGF7n"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <9fc6d5df-108b-5663-5a31-92ca915a9604@FreeBSD.org>
Subject: Re: grep and anchoring
References: <20232C89-B821-41EC-9188-C2A19C679BD8@danieldk.eu>
 <20160626163411.d05f863e.freebsd@edvax.de>
 <362EE01F-4B49-4ADB-A3A6-43F852FFF87F@danieldk.eu>
In-Reply-To: <362EE01F-4B49-4ADB-A3A6-43F852FFF87F@danieldk.eu>

--sW8TwXFtt3AOEitUhmr2kcME38IwPGF7n
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 26/06/2016 15:44, Dani=C3=ABl de Kok wrote:
> Note the anchoring (^), the pattern should only match any four characte=
rs at the beginning of the line, so the expected output is =E2=80=981234=E2=
=80=99 and nothing more. =E2=80=98 123' and '4 12' are not at the beginni=
ng of the line and should consequently not be printed to stdout.
>=20
> For comparison, the output of a recent GNU grep:
>=20
> =E2=80=94
> %  echo "1234 1234 1234" | grep -o '^....'
> 1234
> =E2=80=94

You are completely correct -- this is a bug in grep(1) on FreeBSD.  In
all current releases including the upcoming 11.0-RELEASE grep is
actually GNU grep version 2.1.5.  However, the same bug occurs in
bsdgrep(1):

% echo 1234 1234 1234 | bsdgrep -o '^....'
1234
 123
4 12

There is already an open PR about a very similar issue:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D201650

Could you update that PR with your findings?  Especially that bsdgrep(1)
also shows the same problem.

	Cheers,

	Matthew



--sW8TwXFtt3AOEitUhmr2kcME38IwPGF7n--

--Mx7clcHsOgU5K57EMCdXS3BqKKPefVEU5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

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

iQJ8BAEBCgBmBQJXb/VOXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC
QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkAT+2YQAIXTdNVD8eWikrPzJH+pTTU8
v6rjLcuTVA61pz6eZfyIBSMSik76lLxN2NHDSeIpvkjH4Ff0u8TAb2FRdEDj/XVL
RR6BTr97+2A36UMEvEsnolUoQlJSI0P5SL4arMSqz0McjFDH6gS8bDyALh5e9AkT
kh0Iw9SN//VJuLkXkLrTIUIXlKcfgxtKMHWdNIZo+33wWzkRvfvt8cUN+l4mmFG/
Er56q3fHlgXKwGdqS+9WuTCd922GBqLrWSx4i9buLxueKbsgAueRpU9nN7chpKvx
QbrXVfgSbphKM+ZpuEd723gIWob4xObnWUjwjaE6qquX7R34QcAw1/1mDx0MsM1G
cSliDVT3McYaAz/08avKQW0g5ZhwGqbJPL9q27LL27RduTHGZfjK1enBpm1Pep4Z
wgx8oCh3RLz5VyuJvZKBzIv3z8ly+3WPy2BDYCCyaadUNMpRzJixK24XaVdpdd3O
lbFfC76HT+xR066EEKnpQ1E8VJf17+Kusy3bJySeMj5m6OOGHQ4EMe4diIxNbj09
AE+tivkEK6kxWhu2OpYDpQYhl2H2H3WroZrZ6o2YzvcDdYlxuhb+wFVy1mQ0XDHr
d3emtBmNjYnGGWg9ZeOjCYGbV9zLu65zuG1tiLdyYQzdKLEu6ijLhAfNbEvsfUgS
+Z/HtEEN5ar/zmZM3Mac
=1cHr
-----END PGP SIGNATURE-----

--Mx7clcHsOgU5K57EMCdXS3BqKKPefVEU5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9fc6d5df-108b-5663-5a31-92ca915a9604>