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.
> 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.
I haven't tested it, but I can't help expecting that on a large
file, system("sort...") would be the efficient way.
Hal