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'
In reply to Re: selecting N random lines from a file in one pass
by itub
in thread selecting N random lines from a file in one pass
by seuratt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |