LinuxQuestions.org
Visit Jeremy's Blog.
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 04-09-2004, 07:49 PM   #1
keyops
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Rep: Reputation: 0
grep question


Hi

Trying to grep a 2 gig file for email addresses.

Have looked at using

grep ".*\@[^ ]*[a-zA-Z0-9\-]*\.[a-zA-Z0-9\-]*" <file>

but its not efficient. Can anyone help me on this? I also need to try and use sed or something to only display/copy out the email addresses themselves, not the junk either side. The file is basically a disk image, I used dd to dump it.

Its my old ntfs vol which freaked out big time and I am working in Linux...good learning exercise!

K
 
Old 04-09-2004, 08:32 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Depends on the format and I'm not sure what would count as efficient - or how precise you need to be. This
Code:
grep '.*@.*\..*' html/bookmarks.html | sed 's/^.*mailto://g;s/\".*$//g'
pulls email addresses out of a bookmarks file (not that most people have them there, but just for the idea).

Why did you dump an NTFS volume into a disk image with dd? Or do I not want to know?
 
Old 04-09-2004, 09:17 PM   #3
strikeforce
Member
 
Registered: Jan 2004
Posts: 74

Rep: Reputation: 15
create a sed statement searching for that string the most efficient I've seen is to actually use sed and grep together.
 
  


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 question djgerbavore Linux - Newbie 3 11-04-2004 10:53 AM
Question about Grep irfanhab Linux - Newbie 6 08-23-2004 02:57 PM
grep question djgerbavore Linux - Newbie 7 07-07-2004 07:11 AM
grep question Hockeyfan Linux - General 1 05-15-2004 02:09 AM
grep question vasanthraghavan Programming 3 04-23-2004 12:32 AM

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

All times are GMT -5. The time now is 04:21 AM.

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