From: Robert Klemme Date: 2006-01-06T19:18:00+09:00 Subject: Re: How do you sort a text file? Hal Fulton wrote: > Robert Klemme wrote: >> Danny Abc wrote: >> >>> I'm new to Ruby and was wondering how to sort a text file? >>> >>> With UNIX scripts, I just use "cat input.txt | sort > output.txt". >> >> >> You are entitled to the "useless cat award". :-) > > My neighbor's cat won that already. Oh, on what basis? Does it catch no mice? > > Any reason why you don't >> just do >> "sort input.txt > output.txt"? > > Regarding his original question, I think if he has large files to > sort, he might be well off just using the Unix sort utility. If he > has complex logic, of course, he can still control it all in Ruby. +1 > I haven't tested it, but I can't help expecting that on a large > file, system("sort...") would be the efficient way. +1 robert