From the commandline :-
sort fileName
or if you must do it from ruby
`sort #{filename}`
or if you really don't want to break out to another utility
IO.read( fileName).split.sort
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@tait.co.nz
New Zealand
···
On Wed, 16 Jan 2008, Junkone wrote:
What is the fastest way to sort all the lines of a file alphabetically.