LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 04-13-2007, 10:34 AM   #1
Chikne
Member
 
Registered: Jul 2006
Distribution: Slackware 11
Posts: 140

Rep: Reputation: 15
Using grep with interval expression...


Dear Slackers,

I decided lately that I now have enough experience using GNU/Linux to let myself dig further inside my system, I started learning shell scripting.
So far so good except that every time I try using interval expression with grep I get no match. For instance:

sh-3.1$ echo abababccccccd | grep c\{3\}
sh-3.1$

I expect this expression to be true since it matches from characters 7 to 9.

With sed I do not get those problems:

sh-3.1$ echo abc123ABC | sed -e 's;[[:lower:]]\{3\};$$$;'
$$$123ABC

I am actually puzzled by grep's behaviour, is it actually supposed to be compatible with interval expression? I can't understand why it wouldn't but I might have missed something...

Any suggestions welcome
 
Old 04-13-2007, 10:37 AM   #2
arthropod98
LQ Newbie
 
Registered: Aug 2004
Location: rockville, md
Posts: 3

Rep: Reputation: 0
it worked for me when i put the expression in double-quotes.
 
Old 04-13-2007, 11:04 AM   #3
Chikne
Member
 
Registered: Jul 2006
Distribution: Slackware 11
Posts: 140

Original Poster
Rep: Reputation: 15
Thank you so much!!!
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grep Regular Expression lamar_air Programming 2 07-24-2006 03:40 PM
Help with grep regular expression lamar_air Programming 3 07-21-2006 11:26 AM
Regular Expression + not Working with grep scottwmackey Linux - General 2 06-21-2006 01:31 AM
problems with regular expression and grep bwreath Linux - General 6 03-18-2005 01:43 PM
grep usage with regular expression jonathanztaub Linux - General 7 09-01-2004 10:35 PM


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

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