LinuxQuestions.org
Review your favorite Linux distribution.
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 05-05-2005, 04:27 PM   #1
internal_war
LQ Newbie
 
Registered: May 2005
Posts: 4

Rep: Reputation: 0
egrep question


A friend posed a question to me and I have been unable to figure it out, maybe some genius mind out there can help me. Here goes: (using egrep) Display the records in xxx.dat that contain 30 or more characters. Put them in a file called 'zzz' overwritting.

What I have so far is: grep "(...whatever)" xxx.dat > zzz
 
Old 05-05-2005, 04:39 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Looks like a home-work question to me ...


Please re-read the rules
http://www.linuxquestions.org/rules.php


Cheers,
Tink
 
Old 05-05-2005, 05:28 PM   #3
internal_war
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
it isn't a homework question actually, I happen to have been out of college for about 7 years and I'm new to Linux (which I've installed about 4 months ago). My friend has been using Linux and Unix for a number of years and he tries to help me out by posing these sorts of questions. I resent the accusation that you think so though, I'm sure somebody will help me other than here.

Last edited by internal_war; 05-05-2005 at 05:30 PM.
 
Old 05-05-2005, 05:46 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Calm down mate, and give that animosity a miss.
Look at the type of question. That's something that
just doesn't happen in a real-life environment. The
fact that your pal is trying to get you to know Linux
better still makes it a "homework" question if you
look at it closely.

Do a "man egrep" and read the bit about
"REGULAR EXPRESSIONS"
(a quick way to get there is
Code:
man egrep
/REGULAR EXPRESSIONS<CR>
In particular, look at the bits that deal
with { } constructs.


Cheers,
Tink
 
Old 05-05-2005, 05:50 PM   #5
internal_war
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Ok I see what you're saying, sorry for half flipping on you, I've been trying to try to figure this out for about 4 days now.... it's just getting on my nerves.
 
Old 05-05-2005, 07:10 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
No worries :)

Have you been able to locate the {} things and use them?
If NOT, the quick answer is:

egrep -e".{30,}" <filename> > <otherfilename>

You should try to read and understand that (using
the man-page), though.


Cheers,
Tink
 
Old 05-05-2005, 07:32 PM   #7
internal_war
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Tinkster
egrep -e".{30,}" <filename> > <otherfilename>

ah i had the {30,} never thought about a . thanks.
 
  


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
Parsing out html with egrep binaryechoes Linux - Software 2 12-03-2005 12:49 AM
Parsing out html with egrep binaryechoes Linux - Newbie 3 12-02-2005 01:41 AM
Help with egrep smart_sagittari Linux - Newbie 2 05-02-2005 09:18 AM
Using Grep and Egrep linux-nerd Linux - General 5 10-10-2004 12:37 PM
Using egrep Barbarian Programming 5 10-20-2002 03:54 PM


All times are GMT -5. The time now is 02:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration