Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #195880
| From | Rodolfo Medina <rodolfo.medina@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: List words separated by comma and without duplicates |
| Date | 2018-05-18 21:00 +0200 |
| Message-ID | <vQSLE-66z-13@gated-at.bofh.it> (permalink) |
| References | <vJYCt-8cM-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
> 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 to all who helped. I adopted Tomas' solution:
perl -e 'while(<STDIN>) {chop; push(@result, $_) unless $seen{$_}++;} print(join(", ", @result), "\n");' < authors.auth > authors.txt
It seems to suit my needs.
Cheers,
Rodolfo
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
List words separated by comma and without duplicates Rodolfo Medina <rodolfo.medina@gmail.com> - 2018-04-29 19:50 +0200
Re: List words separated by comma and without duplicates rhkramer@gmail.com - 2018-04-29 20:00 +0200
Re: List words separated by comma and without duplicates "Antonio A. Rendina" <arendina13@gmail.com> - 2018-04-29 20:20 +0200
Re: List words separated by comma and without duplicates David Margerison <deltam@electrosonics.com.au> - 2018-04-30 01:40 +0200
Re: List words separated by comma and without duplicates Bob McGowan <ramjr0915@gmail.com> - 2018-05-01 05:50 +0200
Re: List words separated by comma and without duplicates "Antonio A. Rendina" <arendina13@gmail.com> - 2018-04-29 20:30 +0200
Re: List words separated by comma and without duplicates Abdullah Ramazanoglu <ar018@yahoo.com> - 2018-04-29 20:40 +0200
Re: List words separated by comma and without duplicates <tomas@tuxteam.de> - 2018-04-29 20:30 +0200
Re: List words separated by comma and without duplicates Curt <curty@free.fr> - 2018-04-29 22:20 +0200
Re: List words separated by comma and without duplicates <tomas@tuxteam.de> - 2018-04-29 22:40 +0200
Re: List words separated by comma and without duplicates Gene Heskett <gheskett@shentel.net> - 2018-04-30 00:30 +0200
[OT - long running shows] Re: List words separated by comma and without duplicates Richard Hector <richard@walnut.gen.nz> - 2018-04-30 02:30 +0200
Re: [OT - long running shows] Re: List words separated by comma and without duplicates Gene Heskett <gheskett@shentel.net> - 2018-04-30 03:00 +0200
Re: [OT - long running shows] Re: List words separated by comma and without duplicates Richard Hector <richard@walnut.gen.nz> - 2018-04-30 03:30 +0200
Re: [OT - long running shows] Re: List words separated by comma and without duplicates Gene Heskett <gheskett@shentel.net> - 2018-04-30 05:00 +0200
Re: List words separated by comma and without duplicates Rodolfo Medina <rodolfo.medina@gmail.com> - 2018-05-18 21:00 +0200
Re: List words separated by comma and without duplicates <tomas@tuxteam.de> - 2018-05-18 21:20 +0200
csiph-web