LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 10-10-2009, 05:21 AM   #1
vinaytp
Member
 
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
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware
Posts: 296

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

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


Reply


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 01:55 PM.

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