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
-- 
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================