All,
I have a flat file which contains an email address in every line. I am trying to find a way to extract all the email addresses delimited by comma (,). Can you please show me a way, it will be very helpful, thanks.
All,
I have a flat file which contains an email address in every line. I am trying to find a way to extract all the email addresses delimited by comma (,). Can you please show me a way, it will be very helpful, thanks.
Perhaps using paste
paste -sd, file_with_email_addresses
you need provide us the sample file first.
Should work:
awk -F'[ ,;]' '{for(i=0;++i<=NF;){if($i~/@/)x=(x)?x","$i:$i}}END{print x}' file
if not please provide a data sample
awk -F'[ ,;]' '{for(i=0;++i<=NF;){if($i~/@/)$0=$i}}1' ORS="," file