The bigsort.pl script on page 150 of Ruby Programming for Medicine and Biology, has a few
quirks. First, it assumes that the text file (to be sorted) is a DOS-style
file with a two character (carriage-return,line-feed) linebreak. Also, it
assumes that every line (in the file to be sorted) contains alphanumeric text.
This slightly modified Ruby script will work in any type of text file and does
not require text to appear on any lines of the file.
text = File.open("terms.txt", "r")
out = File.open("terms.put", "w")
linearray = Array.new
begin_position = 0
old_position = begin_position
begin_position = text.pos
line = line.chomp! + " "
linearray << line.slice(0..9) + old_position.to_s
seekplace = value.slice(10..20).to_i
Thanks goes to Dr. Tim Rand, who spotted the error and sent me his own
version of a fix on February 6, 2008.