i have file has 1 email address per line. of them noisy, i.e. contain junk characters before and/or after address, e.g.
name.lastname@bar.com<mailto <someone@foo.bar.baz.edu> <someone@foo.com>mobile <nobody@nowere.com> <ab@cd.com no@noise.com
how can extract right address each line of file in loop this?
for l in `cat file_of_email_addresses` # magic here extract address form $l done
it looks if garbage before address ends lt;
, , if after starts &
try gnu grep:
grep -po '[\w.-]+@[\w.-]+' file
output:
name.lastname@bar.com someone@foo.bar.baz.edu someone@foo.com nobody@nowere.com ab@cd.com no@noise.com
it's not perfect perhaps sufficient task.
Comments
Post a Comment