select a column

I've a file like this:

andrea andre@lol.com october
antonio@lol.com
marco 45247@pop.com
kk@pop.com may
pollo@lol.com
mary mary@lol.com

can I select only the column with email adress?

can I utilise a filter with @ ?

I want obtain this:

andre@lol.com,antonio@lol.com,45247@pop.com,kk@pop.com,pollo@lol.com,mary mary@lol.com

Alfredo

 cat infile | tr " " "\n" | grep @ 

or 

 cat infile | tr " " "\n" | grep @ | tr "\n" ","

Should be close to what you're after...

@Tytalus: Beware of the Herder of Useless Cats! :slight_smile:

tr " " "\n" < file.in | grep @ | tr "\n" "," > file.out