I question the need to randomize the file and rewrite it in the first place. Using something like DBD::SQLite, you can store this stuff into a structured flat file, then write a series of random numbers into a second column, and then select items from your entries column based on a sort of the second column (or write a shuffled index list into the second column).
in reply to Randomize lines with limited memory
Anytime something sounds this hard, it's better to back up a step and say "what corner did I paint myself in to, and how did I get here?". Always question the context.