Hey.
I have a big text file with data,
and i want to extract mail addresses.
How i can do it?
I have a big text file with data,
and i want to extract mail addresses.
How i can do it?
awk '
{
for (i=1;i<=NF;i++) {
if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) {
print $i
}
}
}' "file"
this is a test file foo@bar.com we are looking for moo@drop.dhcp.bar.com email addresses inside, 00test@leo.bar.com, a text file with no particular fname.lname@bar.baz.net other par72@take.the.bus.au restrictions on the format or locations of the 23skidoo@bar.co.uk addresses inside the file. Let's try one at the end joe27@aol.com.
foo@bar.com moo@drop.dhcp.bar.com 00test@leo.bar.com, fname.lname@bar.baz.net 23skidoo@bar.co.uk
foo@bar.com moo@drop.dhcp.bar.com 00test@leo.bar.com fname.lname@bar.baz.net par72@take.the.bus.au 23skidoo@bar.co.uk joe27@aol.com.
foo@bar.com moo@drop.dhcp.bar.com 00test@leo.bar.com fname.lname@bar.baz.net par72@take.the.bus.au 23skidoo@bar.co.uk joe27@aol.com
perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' emails.txt | sort -u > output.txt
perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' emails.txt | sort -u > output.txt
Comment