*** Tag was changed from [OT]: my pitiful post does not deserve to be placed near Russell's luxurious "Cannabis - Schizophrenia link" :-) Brendan Moran wrote: > Does anyone know of an algorithm for sorting extremely > large files of linebreak-separated, case-sensitive ASCII > values? > I have a file that is 3,480,231kB of unsorted ASCII values, > and I need it sorted... and, yes, I do have some idea of > the time that this will take. > I'm using WinXP for this, so win32 compatible utilities > are a good thing for me. Hi, Brendan. While Unix folks are discussing how cool is Unix compared to MS things for this task, I've made a humble attempt to solve it. The environment is MS Excel, as usual: Do you remember " RE: [PIC] Random sequence" ? Paste the code below into Excel sheet VB module. (Open VBA editor, click Sheet1). It will work on activating the sheet (just open another sheet and then return to this one). I create "pseudo" ADO recordset to hold the data. It is rather powerful thing: "sort", "find", "move" etc. Can't predict how it could handle "3,480,231kB", though. Good luck, Mike. --------- ' Simple Demo program to ' 1. Open MS ADO Recordset (OpenRecordset sub) ' 2. Populate the Recordset with records of random chars ' (PopulateRecordset sub) ' 3. Sort the Data (SortRecordset sub) ' 4. Show some first sorted records on Excel sheet ' (ShowFirst10000Records) ' ' Do not forget to set reference to the MicroSoft ' ActiveX Data Object Library (Menu: "Tools" - "References") Option Explicit Private rsPICListArchive As Recordset Private Sub Worksheet_Activate() OpenRecordset Call Beep: DoEvents PopulateRecordset Call Beep: DoEvents SortRecordset Call Beep: DoEvents ShowFirst10000Records Call Beep: DoEvents End Sub Private Sub OpenRecordset() Set rsPICListArchive = New Recordset With rsPICListArchive .Fields.Append "PKId", adInteger .Fields.Append "Chars", adVarChar, 20 .Open .Fields("Chars").Properties("OPTIMIZE") = True End With End Sub Private Sub PopulateRecordset() Dim i As Long With rsPICListArchive For i = 0 To 10000 .AddNew .Fields("PKId") = i .Fields("Chars") = GetRandomString .Update Next i End With End Sub Private Sub SortRecordset() rsPICListArchive.Sort = "Chars" End Sub Private Sub ShowFirst10000Records() Dim i As Long With rsPICListArchive .MoveFirst Do i = i + 1 Cells(i, 1) = .Fields("Chars") DoEvents .MoveNext Loop While i < 10000 And Not .EOF End With End Sub Private Function GetRandomString() As String Dim i As Long For i = 1 To 10 GetRandomString = GetRandomString & Chr(50 + Int(Rnd * 50)) Next i End Function -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads