I've written a short BASIC program that sorts the lines in a text file, taking capitals, undercasts and all sorts of diacritics, as well most other characters into account. My own example has nearly 6000 lines. The BASIC version took about 23 seconds to sort them, while the compiled version took less than 3 seconds to do the job. (On a 4té2 computer.) The text file is not included, but you should rename yours to "Texts" in order to let the program do its work. If your text file counts more than 6000 lines, you should change the DIM's in the program. Compile the program with the freely available !ABC compiler. Remember that the compiled version needs quite a big NEXT slot. There are much better or memory friendly ways to do this, but as an example it may have some use. Paul REM DIM two string arrays, REM big enough to store your lines. REM My example had 5913 lines. DIM text$(5913), dummy$(5913) REM Now store every line into both arrays. REM The dummy array will be adjusted on the fly, REM by changing undercast into capitals and by REM removing diacritics, in FNcase (see botom). f%=OPENIN("Texts") IF f%>0 THEN a%=0 REPEAT a%+=1 text$(a%) = GET$#f% dummy$(a%) = FNcase(text$(a%)) UNTIL EOF#f% ENDIF IF f%>0 THEN CLOSE#f% REM NOW the actual sorting will start OK% = TRUE time = TIME PROCsort t = TIME - time : REM The time needed in centiseconds. REM Finally, print the sorted lines FOR i% = 1 TO a% : PRINT STR$(i%) +": " + text$(i%) : NEXT PRINT t END DEF PROCsort FOR i% = 1 TO a% IF dummy$(i%) < dummy$(i%-1) THEN SWAP text$(i%),text$(i%-1) SWAP dummy$(i%),dummy$(i%-1) OK% = FALSE ENDIF NEXT IF NOT OK% THEN OK% = TRUE : PROCsort ENDPROC DEF FNcase(x$) y$="" FOR j%= 1 TO LEN x$ c%=ASC(MID$(x$,j%,1)) IF c%>96 AND c%<123 THEN y$ += CHR$(c%-32) : REM undercast -> capital IF c%>47 AND c%< 58 THEN y$ += CHR$(c%) : REM numbers don't change IF c%>64 AND c%< 91 THEN y$ += CHR$(c%) : REM capitals don't change IF c%>223 AND c%<230 THEN y$ += "A" : REM diacritics removed IF c%>231 AND c%<231 THEN y$ += "E" IF c%>235 AND c%<240 THEN y$ += "I" IF c%>241 AND c%<247 THEN y$ += "O" IF c%>248 AND c%<253 THEN y$ += "U" IF c%=229 OR c%=197 THEN y$ += "A" IF c%=230 OR c%=198 THEN y$ += "AE" IF c%=231 OR c%=199 THEN y$ += "C" IF c%=241 OR c%=209 THEN y$ += "N" IF c%=248 OR c%=216 THEN y$ += "O" IF c%=223 THEN y$ += "SS" IF c%=255 THEN y$ += "Y" NEXT =y$