[PLUG] egrep syntax correction

David Fleck david.fleck at mchsi.com
Sat Jul 4 23:54:24 UTC 2015


On Sat, 2015-07-04 at 19:28 -0400, Pete Lancashire wrote:
> To HOT to think
> 
> don't forget to end the regexp stop with a non-digit if you dont
> P12345<anything> will pass.
> 
> On Sat, Jul 4, 2015 at 7:25 PM, Pete Lancashire <pete at petelancashire.com>
> wrote:
> 
> > Don't use the back slash, and use single quotes to force all the
> > expression to go to egrep directiy
> >
> > -pete happy HOT 4th
> >
> > On Sat, Jul 4, 2015 at 7:09 PM, Rich Shepard <rshepard at appl-ecosys.com>
> > wrote:
> >
> >>    I have an 851 line data file in which certain lines begin with P
> >> followed
> >> by 5 digits. I want to count the number of those lines. Despite reading
> >> the
> >> grep man page I am missing the correct syntax.
> >>
> >>    The expression
> >>         egrep -cE "^P[[:digit:]]\{5\}" hrwq.dat
> >> returns a count of zero (0). So do variations of options and search
> >> strings.
> >>
> >>    What have I missed here?
> >>
> >> Happy 4th, all,
> >>
> >> Rich
> >> _______________________________________________
> >> PLUG mailing list
> >> PLUG at lists.pdxlinux.org
> >> http://lists.pdxlinux.org/mailman/listinfo/plug
> >>
> >
> >
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug

Try removing the backslashes:

egrep -cE "^P[[:digit:]]{5}"

That works for me.





-- 
David Fleck <david.fleck at mchsi.com>




More information about the PLUG mailing list