News for hackers. Stuff that matters.
Re:GNU Parallel by known on Monday December 26, 2016 @09:27AM (#13258338)
cat 100GB_data_file_with_DUPLICATE_lines | parallel --pipe awk \'\!a[\$0]++\' > data_file_with_UNIQUE_lines

is BETTER since it uses less computer resources than

gawk '!a[$0]++' 100GB_data_file_with_DUPLICATE_lines > data_file_with_UNIQUE_lines

Re:GNU Parallel by decisiveness on Monday December 26, 2016 @04:20PM (#13259818)
The parallel example will definitely not work as you expect, and will likely result in most duplicate lines still being present. When using --pipe this way, if you don't declare --block to be the size of the file (in which case there's no benefit to using parallel), each parallel execution will be run on a separate 1MB (default --block size) chunk of the file before outputting results all separately, then together in a single group (stdout), to the output file.

If you're looking to spread work across CPUs and correctly get the desired output, I'd do something like:

    parallel -a input.txt --pipepart mawk \'\!a[\$0]++\' | mawk '!a[$0]++' > output.txt
I used mawk because it is typically much more performant on large files.
Re:GNU Parallel by snvzz on Monday December 26, 2016 @12:40PM (#13259010)
That's a classic misuse of cat.

Just use '<'.

Re:GNU Parallel by kamijo-k on Tuesday December 27, 2016 @07:35AM (#13262738)
Yeah, but to me, this "misuse" actually makes the input and output clearer than using "<" and ">" together. After all, it places input on the left side of the command, and output on the right side.
Re:GNU Parallel by ole_tange on Tuesday December 27, 2016 @09:01AM (#13263149)
Except for GNU Parallel --pipe. When you use '<' what you typically mean is '--pipepart -a file'.