Share your knowledge at the LQ Wiki.
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 11-11-2007, 08:14 AM   #1
LQ Newbie
Registered: Nov 2007
Posts: 5

Rep: Reputation: 0
using grep and egrep in the terminal

Create a file containing some lines that you think would match
the regular expression: (^[09]{1,5}[azAz]+$)|none and some
lines that you think would not match.
Use egrep to see if your
intuition is correct.
Old 11-11-2007, 08:24 AM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405

This screams: Homework! Which we don't do for you (because I don't want to and because the LQ rules say so). Get to the chapter that deals with regular expressions, read the (e)grep man page.

If you get stuck on a specific issue, you can post it here and we can give you some pointers.
Old 11-11-2007, 08:40 AM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
This looks like your second "cut and paste" homework question.

There is a lot of misunderstanding about homework here. You ARE allowed to post homework questions. The rules only say that you should not expect us to actually do anything.

My rule: If you just cut and paste from the assignment sheet---and give no evidence of trying to solve the problem--I will not lift a finger to help you.

As a minimum, tell us what text they use in the class and where you are getting stuck.
Old 11-11-2007, 09:27 AM   #4
Senior Member
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98

I've done the exercise and it behaved pretty much as I expected

All the information you need is included in the question you posted. Cross reference your homework with the following:
man grep
BTW there are 186 unique combinations that match the regular expression (^[09]{1,5}[azAz]+$)
There are 248 unique combinations if (as I suspect) the regular expression should have been (^[09]{1,5}[azAZ]+$)

Last edited by Disillusionist; 11-11-2007 at 09:57 AM.


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/egrep logical AND function? boozer_2 Linux - Newbie 11 04-10-2010 01:19 AM
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 08:15 AM
egrep/grep regex question buldir Programming 7 05-08-2006 07:17 PM
Problem matching strings with grep/egrep Seb74 Linux - Newbie 5 05-26-2005 01:40 PM
Using Grep and Egrep linux-nerd Linux - General 5 10-10-2004 11:37 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:45 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
Open Source Consulting | Domain Registration