grep newbie needs help

AlanCE

Registered
I'm trying to use the Mac OS X terminal and grep to pull good addresses from an email list. Basically I need to extract, from one particular file, anything matching:

grep [sometext]@[sometext].[sometext] sourcefilename > destinationfilename

what do i need to make this work?

Thanks!

Oh, the file format is one email address per line. I used bbedit to save the file with UNIX line breaks if that makes any difference.
 
grep -E -e '\w+@\w+\.\w+' inputfile >outputfile

Do a 'man grep'

However, if you have excessively funky characters, the '\w' might
not pick it up. You would want .+ in that case.
 
Back
Top