I want to shuffle the lines of a file with a fixed seed so that I always get the same random order. The command I am using is as follows:
sort -R file.txt |
If you're randomly shuffling lines, you're not sorting. I haven't seen a sort with --random-source prompt before. It'd be interesting if it does exist. However, that's not sorting the lines in a fixed order.
I believe you'll have to write a program to that, and I don't think Bash can quite do it.
Actually, it might. The $RANDOM environment variable selects a random number from 0 to 32767. You can assign a seed to RANDOM and the random number sequence will appear over and over. You can use a card dealing algorithm. Read in each line into a Bash array, then use the card dealing algorithm to pick each line.
I'm not going to write a test program -- especially in Bash, but you should get the idea.