On Tue, 18 Apr 2006 16:01:10 -0700, robic0 wrote:
>On Tue, 18 Apr 2006 22:53:01 GMT, "John W. Krahn" <> wrote:
>
>>Harry wrote:
>>> Zachary wrote:
>>>>Say I've got 7 files ( file1.txt - file7.txt) and I want to combine the
>>>>lines from all 7 files into one file (file8.txt) but I want the line
>>>>order to be randomly mixed. In other words, I want file8.txt to
>>>>contain all the lines from file1.txt through file7.txt but in random
>>>>order so that each pass produces a different file8.txt. Might someone
>>>>help me accomplish this? Keep in mind that files 1-7 may not contain
>>>>the same number of lines. One may have a hundred lines wile the other
>>>>may only have ten.
>>>
>>> Don't re-invent the wheel 
>>>
>>> Google "randomize text file" will point you to here, which
>>> co-incidently, is a Perl script.
>>>
>>> Random Text Version 1.0
>>> http://www.rahoorkhuit.net/programmi...xt/index.shtml
>>
>>Wow, you must be a brave little coder, posting a Perl4 Matt Wright script
>>here. And one that only prints a single line from a file instead of
>>randomising the entire file. 
>>
>>
>>John
>
>You know, actually you could cat all the files into one (no matter how big).
>Given the number of lines in the file, using Tie::File or something, you
>could get a randome number between 0..last line, then print it out.
>I guess..
But hey, the file cat wouldn't seem to be the point (as the subject suggests).
Though for efficiency, why cat files? A random file(/lines) ([filex,lines]) index
is obtained, then the line index is randomized. Does randomize know file numbers?
How many files you need for a good statistical spread? The more the better.
Then Tie::File, rinse, repeat...