"No problems", I said, "a 5 line Perl script and you're done". But later it occurred to me - why 5 lines ? This will do the job:
So, how about making it even shorter ?cat file1 file2 | perl -ne 'print if !(defined($foo{$_})); $foo{$_} = +1;' > out_file
Note: my version is ungolfed for clarity
Note2: golf only the Perl code between 's, not the shell wrapper
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Golf) unique
by broquaint (Abbot) on Apr 24, 2003 at 15:14 UTC | |
by insensate (Hermit) on Apr 24, 2003 at 16:14 UTC | |
by jmcnamara (Monsignor) on Apr 24, 2003 at 16:51 UTC | |
by sauoq (Abbot) on Jun 04, 2003 at 07:50 UTC | |
by jmcnamara (Monsignor) on Jun 04, 2003 at 10:17 UTC | |
| |
by sauoq (Abbot) on Jun 04, 2003 at 17:07 UTC | |
|
Re: (Golf) unique
by jmcnamara (Monsignor) on Apr 24, 2003 at 16:18 UTC | |
by Jasper (Chaplain) on Apr 24, 2003 at 17:20 UTC | |
|
Re: (Golf) unique (and the winner is...)
by sauoq (Abbot) on Jun 04, 2003 at 07:47 UTC |