Random lines selection form a file.

>cat data.dat
0001 Robbert
0002 Nick
0003 Mark
.......
1000 Jarek

Prepend a random number to each line, sort the file, take the first few lines, and remove the leading random number.

 awk 'BEGIN {srand()} {printf "%05.0f %s \n",rand()*99999, $0; }' datafile | sort -n | head -100 | sed 's/^[0-9]* //'
1 Like

I afraid, if this is going to generate any duplicate random numbers in range from 1 to 100? If yes then how can you avoid that?
If this generates the duplicate numbers then the same record will be picked up more than once.

Cheers,
McLan

Why don't you try it? The range of rand()*99999 is not 1-100, duplicate random numbers are possible, duplicate lines selected from your file are not possible.