Well i have the following script which takes as input parameter a webpage
and extract the emails from it.
The results are correct but i was wondering whether i could rewrite it
in a better, 'cleaner' manner.
I think my for loop is a bit ...primitive and also each email is printed
twice
Code:
#!/bin/bash
echo $1
echo "The script starts now."
echo "Hi, $USER!"
wget $1 -O webpage.txt
awk '
{
for (i=1;i<=NF;i++) {
if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) {
print $i
}
}
}' webpage.txt
My main concern is the part inside awk '{...}'
Any ideas ?