Go Job Hunting at the LQ Job Marketplace
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 09-01-2003, 04:38 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 27

Rep: Reputation: 15
regexp question

I use bash2.05.

echo "ab]" | grep '^[a-z]*$

How to add ']' in a set of acceptable symbols? \] doesn't work
Old 09-01-2003, 10:59 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,840

Rep: Reputation: 342Reputation: 342Reputation: 342Reputation: 342
'man regexp' explains how to do it, in the section titled 'Regular Expressions' (last paragraph).
Old 09-01-2003, 11:10 AM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I don't think grep handles regular expressions unless you give the -E or -G option. I could be wrong, but I don't know why they would include those options if grep handled regexps out-of-the-box.
Old 09-01-2003, 12:50 PM   #4
LQ Newbie
Registered: Jul 2003
Posts: 27

Original Poster
Rep: Reputation: 15
Shortly speaking, RTFM, as usual:
[To include a literal ] place it first in the list. Similarly, to include a literal ^ place it anywhere but first. Finally, to include a literal - place it last]


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
regexp help cliff76 Linux - Newbie 3 03-07-2008 02:15 PM
little help for regexp EmOuBi Linux - Newbie 6 08-06-2005 02:19 AM
Regexp question scuffell Programming 4 04-30-2005 03:35 AM
regexp help ... pld Programming 1 03-15-2005 03:45 PM
postfix regexp question wijnands Linux - Newbie 1 06-03-2004 06:19 AM

All times are GMT -5. The time now is 02:02 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