home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / euphor10.zip / FILESORT.EX < prev    next >
Text File  |  1993-05-07  |  615b  |  28 lines

  1. -- Read in a file, sort it, and write it out.
  2. -- Much faster than MS-DOS sort command.
  3. -- Will use extended memory to quickly sort files much larger than  
  4. -- what MS-DOS sort can handle.
  5. -- usage: ex filesort < source > dest
  6.  
  7. include sort.e
  8.  
  9. procedure file_sort()
  10.     sequence buffer, sorted_buffer
  11.     object line
  12.  
  13.     buffer = {}
  14.     while 1 do
  15.     line = gets(0)
  16.     if atom(line) then
  17.         exit
  18.     end if
  19.     buffer = append(buffer, line)
  20.     end while
  21.     sorted_buffer = sort(buffer)
  22.     for i = 1 to length(sorted_buffer) do
  23.     puts(1, sorted_buffer[i])
  24.     end for
  25. end procedure
  26.  
  27. file_sort()
  28.