Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-09-2004, 08:49 PM   #1
LQ Newbie
Registered: Apr 2004
Posts: 4

Rep: Reputation: 0
grep question


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!

Old 04-09-2004, 09:32 PM   #2
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
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, 10:17 PM   #3
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.


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

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