Randomly shuffling lines in Linux / Bash

You should use shuf command =)

cat file1 file2 | shuf

Or with Perl :

cat file1 file2 | perl -MList::Util=shuffle -wne 'print shuffle <>;'

Leave a Comment