LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2005, 09:08 AM   #1
minil
Member
 
Registered: Dec 2004
Location: Bangalore, India
Distribution: Fedora 2
Posts: 74

Rep: Reputation: 15
whats the meaning of grep '[a-9]' ..


whats the meaning of
[Quote] grep '[a-9]' file. [Quote]

Thanks in advance
Minil
 
Old 12-28-2005, 09:15 AM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
all the patterns of the form would be selected

patterns with a-z
patterns with a-z and 0-9 (in any order)

not patterns with just A-Z
not patterns with just 0-9
 
Old 12-28-2005, 09:21 AM   #3
minil
Member
 
Registered: Dec 2004
Location: Bangalore, India
Distribution: Fedora 2
Posts: 74

Original Poster
Rep: Reputation: 15
can u explain me with examples??
 
Old 12-28-2005, 10:33 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: NetBSD, Void, Debian, Mint, Ubuntu, Puppy, Raspbian
Posts: 3,487

Rep: Reputation: 233Reputation: 233Reputation: 233
It's nonsensical, it's not a valid range in grep.
try it:

echo b | grep '[a-9]'

it's supposed to be a range but it's wrong.
[A-Za-z0-9] are valid.
[a-9] will match 'a' and '9' only.
 
Old 12-29-2005, 10:41 PM   #5
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Quote:
Originally Posted by bigearsbilly
[a-9] will match 'a' and '9' only.
Thats true,

patterns would match if it contains either 'a' or 9 in the string.
 
  


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
grep ?? can grep us variables? DaFrEQ Linux - Software 4 09-14-2005 01:22 PM
What does rpm -qa |grep th* (as compared to rpm -qa |grep th) display? davidas Linux - Newbie 2 03-18-2004 02:35 AM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 04:11 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 12:38 PM
exit code=10 whats its meaning? pctwister Linux - Hardware 2 06-13-2003 08:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:01 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration