Here's a stupid shell trick to do so.
- First, break the file down two 2 byte chunks using
xxd
- Shuffle it with
shuf
- Reassemble the file using xxd.
eg.
xxd -p -c 2 input_file | shuf - | xxd -p -r - output_file
I haven't tested it on huge files. You may want to use an intermediary file.
Alternately, you could use sort -R
like so:
xxd -c 2 in_file |sort -R | cut -d' ' -f 2 | xxd -r -p - out_file
This depends on xxd
outputing offsets, which should sort differently for each line.