Re: List words separated by comma and without duplicates
On Sun, 2018-04-29 at 19:43 +0200, Rodolfo Medina wrote:
> Hi all.
>
> Suppose I have a file made by a list of names and surnames, e.g.:
>
> Arvo Part
> Harold Pinter
> Lucio Battisti
> Antonio Amurri
> Eduardo De Filippo
> Eduardo De Filippo
>
> and that I want them listed all on one line, separated by a comma and without
> duplicates, i.e.:
>
> Arvo Part, Harold Pinter, Lucio Battisti, Antonio Amurri, Eduardo De Filippo
>
> How can I do that with proper Unix commands?
>
> Thanks for any help.
>
> Rodolfo
>
Sorry, forgot uniq...
cat list-file | uniq | sed s/$/,/ | tr '\n' ' '
Reply to: