From: Eric Hodel Date: 2007-08-12T09:01:45+09:00 Subject: Re: Sorting a logfile, how would you write it? On Aug 11, 2007, at 15:30, William James wrote: > On Aug 11, 7:15 am, Robert Klemme wrote: >> It's a one liner: >> >> ruby -i.bak -e 'puts ARGF.readlines.sort_by {|l| l[/^\d+/].to_i}' >> file > > It's my understanding that when you use -i, a temporary file > is created, the original file is deleted, and the temporary > file is renamed. Doesn't this cause unnecessary disk > fragmentation? If I had a filesystem where I had to worry about fragmentation I wouldn't care. The amount of time spent figuring out some best way to "fix" it is going to be less than the time running a defragmenter will take. -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars