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
>
I would do something like that:
cat list-file | sed s/$/,/ | tr '\n' ' '
If you want to improve your bash skills you can read:
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/
It is really useful.
--
Antonio
Reply to: