LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   pattern matching (https://www.linuxquestions.org/questions/linux-newbie-8/pattern-matching-760954/)

vinaytp 10-10-2009 05:21 AM

pattern matching
 
Hi all..

I am trying to match a number with atleast 5 digits but following is not working

echo 123456 | grep '\d{5,}'

Can anyone help me please

Thanks in advance...

vonbiber 10-10-2009 06:05 AM

try that instead
Code:

echo 123456 | grep '[0-9]\{5,\}'

syg00 10-10-2009 06:06 AM

Grep uses standard regex's unless told otherwise - that's a perl regex. What you want can also be done with character classes. See the manpage.


All times are GMT -5. The time now is 10:28 PM.