in reply to selecting N random lines from a file in one pass
There is one potential problem, depending on what one wants. If the file size is smaller than the sample size, you can get a sample with "holes":
$ ./select.pl 3 1 2 [0] '2' [1] '' [2] '1'
|
---|