On Thu, 05 Jan 2006 21:28:08 -0000, <ara.t.howard / noaa.gov> wrote:

> On Fri, 6 Jan 2006, 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".
>
>
>    open("output.txt"){|f| f.write IO::readlines("input.txt").sort}
>
> -a

Alternatively, sticking with the command-line thing, how about:

	cat input.txt | ruby -e 'puts $stdin.sort' > output.txt

-- 
Ross Bamford - rosco / roscopeco.remove.co.uk