Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-10-2009, 05:21 AM   #1
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
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...
Old 10-10-2009, 06:05 AM   #2
Registered: Apr 2009
Distribution: slackware 14.0 32-bit, slackware 14.1 64-bit
Posts: 329

Rep: Reputation: 52
try that instead
echo 123456 | grep '[0-9]\{5,\}'
Old 10-10-2009, 06:06 AM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,248

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pattern matching and substitution mailbox-1691 Linux - General 1 08-12-2009 08:27 AM
Pattern Matching Aveltium Linux - Newbie 5 04-12-2009 11:14 PM
need help with perl - pattern matching johngreg Programming 5 10-13-2008 01:08 PM
pattern matching in file amitpardesi Linux - Software 5 02-08-2008 07:06 AM
pattern matching nadeemr Linux - Newbie 8 06-13-2007 11:05 AM

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration