Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2016 15:10:57 +0200
From:      =?utf-8?Q?Dani=C3=ABl_de_Kok?= <me@danieldk.eu>
To:        freebsd-questions@freebsd.org
Subject:   grep and anchoring
Message-ID:  <20232C89-B821-41EC-9188-C2A19C679BD8@danieldk.eu>

next in thread | raw e-mail | index | archive | help

Dear all,

After a BSD hiatus of many years, I am tinkering with FreeBSD again. I’ve run into some strange issue with grep and beginning of line (^) anchoring:

—
% echo "1234 1234 1234" | egrep -o '^….'
1234
 123
4 12
% echo "123412341234" | egrep -o '^....'
1234
1234
1234
—

Any idea what is going on here?

(Recent GNU grep from ports gives the expected output.)

With kind regards,
Daniël de Kok

Ps., grep on OS X, which seems to be the same version has similar problems…


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20232C89-B821-41EC-9188-C2A19C679BD8>