Shuffle lines

... | perl -MList::Util=shuffle -e 'print shuffle <>;'

January 31, 2016openiduser81

Explanation

Sorting lines is easy: everybody knows the sort command.

But what if you want to do the other way around? The above perl one-liner does just that:

  • -MList::Util=shuffle load the shuffle function from the List::Util package
  • -e '...' execute Perl command
  • print shuffle <> call List::Util::shuffle for the lines coming from standard input, read by <>

Related one-liners

Shuffle lines

... | perl -MList::Util -e 'print List::Util::shuffle <>'

October 25, 2014bashoneliners