[clug] Circumflex

Eyal Lebedinsky eyal at eyal.emu.id.au
Sat Aug 19 13:21:41 UTC 2017


On 19/08/17 22:50, Bryan Kilgallin (iiNet) via linux wrote:
> I have been trying out egrep on an old text file tabulating American bulletin boards such as the following.
> 
> {
> / Number / Name           /Type  /Baud rate /Type of BBS
> 
> ---------------------------------------------------------------
> 
> 221-0774 /CCIS Hopewell   / IBM  / 300/1200 /General BBS
> }
> 
> So I have been applying search terms in a RegEx document supplied by Scott. Therein I read
>      "\d    Any Digit", and also
>      "[0-9]    Numbers 0 to 9".
> 
> I can get one of those phone-number records by searching thus.
>      egrep '^[0-9]'
> But the following selects nothing!
>      egrep '^\d'
> What went wrong?

I think that the '\d' notation is a Perl extension, so try
	grep -P ^\d'

Note that 'egrep' is short for 'grep -E' (extended regex) and you cannot use '-E' and '-P'
together as they have conflicting rules.

-- 
Eyal Lebedinsky (eyal at eyal.emu.id.au)



More information about the linux mailing list