Created
July 5, 2012 17:55
-
-
Save amacinho/3055198 to your computer and use it in GitHub Desktop.
Shuffle the lines of a file -- the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For other ways of doing this see this question on stackoverflow: http://stackoverflow.com/questions/2153882/how-can-i-shuffle-the-lines-of-a-text-file-in-unix-command-line | |
cat myfile | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2- > myfile.shuffled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment