How to sort randomly (shuffle) file lines efficiently?
sorting
Solution
You could try `shuf`. It should be faster since it is dedicated to the job.
Problem
`sort` has a `--random-sort` option, but this option makes `sort` significantly slower: ``` # time sort --random-sort input >/dev/null real 0m7.247s user 0m7.232s sys 0m0.004s ``` Without `--random-sort`, it's 10 times faster: (`input` is not previously sorted) ``` # time sort input >/dev/null real 0m0.625s user 0m0.616s sys 0m0.008s ``` Why is this so slow ? Is their a way to shuffle a file's lines efficiently ?