From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <201107050956.18175.dexen.devries@gmail.com> References: <201107050956.18175.dexen.devries@gmail.com> Date: Sun, 10 Jul 2011 20:08:17 -0400 Message-ID: Subject: Re: [9fans] grep (or perhaps regex(6)) question From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: fdabee6a-ead6-11e9-9d60-3106f5b1d025 On Tue, Jul 5, 2011 at 3:56 AM, dexen deVries wro= te: > on plan9port: > % echo foobar | 9 grep '$JUNK' > =C2=A0-> foobar > > that is, p9p grep matches any line with regular expression in form of > $ANY_REGEX > > why is it so? It's an ancient bug in the Plan 9 grep, a complication of the way Ken implemented ^ and $: as aliases for \n (!). It looks like someone added a workaround for this one case in the Plan 9 sources since I forked them for plan9port seven years ago. I pulled it in. For fun, try seeing what matches '^$^$' across a variety of grep implementations. Russ