[PLUG] egrep syntax correction

Pete Lancashire pete at petelancashire.com
Sat Jul 4 23:52:41 UTC 2015


$ cat p
P12345
P123
P12
P1
S1
S12
S123
S1234
S12345
P1234
P123456
P1234z
P12345a
P12345abc

$ cat p | egrep -ce '^P[[:digit:]]{5}'
4

$ cat p | grep -ce '^P[[:digit:]]{5}'
0

OH OH .. should be (upper case) E :-)
$ cat p | grep -ce '^P[[:digit:]]{5}'
0





On Sat, Jul 4, 2015 at 7:43 PM, Rich Shepard <rshepard at appl-ecosys.com>
wrote:

> On Sat, 4 Jul 2015, Pete Lancashire wrote:
>
> > don't forget to end the regexp stop with a non-digit if you dont
> > P12345<anything> will pass.
>
>    There is content after the Pnnnnn; all I want is a count of the number
> of
> lines beginning with Pnnnnn.
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list