Thread: grep 2 at signs
View Single Post

   
  #5 (permalink)  
Old 02-15-2008, 07:06 PM
Bob Stockler
 
Posts: n/a
Default Re: grep 2 at signs

Jean-Pierre Radley wrote (on Mon, Jul 10, 2006 at 06:05:44PM -0400):

| Bob Stockler typed (on Mon, Jul 10, 2006 at 05:16:48PM -0400):
| | Jeff Hyman wrote (on Mon, Jul 10, 2006 at 04:46:54PM -0400):
| |
| | | bob@vodka.com
| | | jpr@jane.com
| | | jeff@needshelp.net
| | | joey@test.net
| | | jeff@waylon@bank.com
| | | ^------^------------ 2 @ signs
| | |
| | | I want to locate any email with 2 "at" signs inside file "file_list".
| | | Keep in mind there is only ONE email per line and there are
| | | 10's of thousands of email addresses in "file_list".
| | |
| | | # grep "*@*@" file_list Displays every line
| | | # grep "*\@*\@" file_list Displays every line
| |
| | How about:
| |
| | egrep '.*@.*@' file_list
| | or
| | awk '/.*@.*@/ { print }'file_list
| |
| | Bob (who would use mawk 'cause it'd be fastest)
|
|
| When it comes to commands, JP goes by the shibboleth that
| 'shorter is better', so he'd scratch one each of ".", "*",
| " ", "{", " ", "p", "r", "i", "n", "t", " ", "}" and just type:
|
| mawk '/@.*@/' file_list

More elegant . . . less informative to those less knowledgeable.

OTOH it does, in fact, inform (or remind) us of the subtleties
of AWK, which by default prints any matched line.

Bob

--
Bob Stockler +-+ bob@trebor.iglou.com +-+ http://members.iglou.com/trebor
Reply With Quote