nawk '$0 ~ /@/ { for (i=1;i<NF+1;i++){ if ($i ~ /@/) print $i } } ' $1 nawk '$NF ~ /@/ {print $NF }' $1