| Raw Input
| |
Given a line consists of several e-mail addresses separated by spaces,
for example:
| john@a.com mary@b.com kelly@c.org joe@b.com bruce@e.edu monica@b.comma
|
|
| Desired Output
| |
What we want is user names of those e-mail addresses destined to @b.com,
be aware that 'monica@b.comma' must be filtered out:
| mary joe
|
|
Script and Comments
Script1 [perl] [ 1] s/[^ @]+\@(?!b\.com(?=$| ))[^ ]+//g
[ 2] s/\@b\.com//g
|
Script2 [sed] [ 1] s/@b\.com/@/g
[ 2] s/[^ @]*@[^ ][^ ]*//g
[ 3] s/@//g
| |