Using Ruby’s special stream, ARGF, shuffling the lines in a file is trivial:

$ cat foo.txt | 
ruby -e "puts ARGF.readlines.collect.shuffle rescue Errno::EPIPE"