in reply to text sorting question, kinda

If you don't want to be saving any of the elements in arrays or anything like that, you could always just make two runs through the file. The first would check for the 'blah blah' lines and write those to a temporary file. The second would append the remaining lines to the end. Sure it means you have to read through the file twice, but if you're worried about memory usage, this only holds on to one line at a time.