Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Some Way To Alphabetize A List Of Words

  1. #11
    Poster
    Join Date
    Dec 2003
    Location
    ...Glass tubes all look alike from the inside.
    Posts
    142
    Lol... the guy just wants to sort a text file. He doesnt even need the command prompt for that.

    *bangs head against the keyboargdsfbyhnisd*

    Ok, look, here's a quick QBasic routine that will sort your file for you.

    Code:
    DIM textline(5000) AS STRING
    OPEN "text.txt" FOR INPUT AS #1
    
    loopcounter = -1
    
    DO
     loopcounter = loopcounter + 1
     LINE INPUT #1, textline(loopcounter)
    LOOP UNTIL EOF(1)
    
    CLOSE #1
    
    DO
     flag = 0
     FOR loopcounter2 = 0 TO loopcounter - 1
     IF textline(loopcounter2) > textline(loopcounter2 + 1) THEN
      temp$ = textline(loopcounter2)
      textline(loopcounter2) = textline(loopcounter2 + 1)
      textline(loopcounter2 + 1) = temp$
      flag = 1
     END IF
     NEXT
    LOOP UNTIL flag = 0
     
    OPEN "text2.txt" FOR OUTPUT AS #2
    FOR lc3 = 0 TO loopcounter
     WRITE #2, textline(lc3)
    NEXT
    CLOSE #2
    
    END
    Copy and past that into notepad, and save it as c:\qbasic\sort.bas

    Now, go find a copy of Qbasic on the internet - its not hard to find. In fact, you can find a copy at http://webpages.csus.edu/~sac19488/qbasic.htm. Install that to c:\qbasic
    Now, put a copy of the text file you want to sort into the directory you installed qbasic in, and rename it to text.txt
    Then, just load qbasic. Press alt+F to open the file menu, then O to get the open menu. You should see sort.bas in one of the boxes - that means everythings set right. type sort.bas, and press enter.
    Then, press shift+F5. this begins running the program. a few moments later, you'll get "Press any key to continue" appear on a black screen - the program has finished running. press any key, and press alt+f, then x to exit qbasic.

    Yeah, i could compile the code, but i figure ill make you do things the hard way.


    Note - if the original file contains more than 5000 entries, just change the 5000 on the first line to the number of entries you have. simple, eh?

    The routines a basic bubble sort - it does the job, it does it reliably. Just not as quickly as a binary sort, but i cant be bothered to code one atm. Sorted.

  2. Software & Hardware   -   #12
    Poster
    Join Date
    Dec 2003
    Location
    ...Glass tubes all look alike from the inside.
    Posts
    142
    AS a side note, i know there might be easier ways of doing that, that dont involve relying on someone elses badly written code for a defunct language. but right now, im cold, tired, and not really thinking straight. If you can't be arsed, send me the file via ICQ and i'll sort it for you.

  3. Software & Hardware   -   #13
    Originally posted by Project E-01@30 December 2003 - 01:36
    AS a side note, i know there might be easier ways of doing that, that dont involve relying on someone elses badly written code for a defunct language. but right now, im cold, tired, and not really thinking straight. If you can't be arsed, send me the file via ICQ and i'll sort it for you.
    Thanks for the input, but the previous suggestions sounds more difficult than balamms.

    I just need a simple program or online utility that alphabetizes words. im currently downloading Winword. to see if that can get it done.

    I could have done this Alphabetizing manually 20 times already. but im on a mission now

  4. Software & Hardware   -   #14
    Poster
    Join Date
    Mar 2003
    Posts
    3,582
    excel will sort things alphbetically but we don't know what format this text file is in. What prefixes are used, is it consistent, ???

    give it a try if it's all just filename.extension but make sure you run it on a copy, not the original.

  5. Software & Hardware   -   #15
    Vargas's Avatar gone fishin'
    Join Date
    Jul 2003
    Location
    the poopdeck
    Posts
    1,878
    Originally posted by Kevhead2@29 December 2003 - 03:36
    I have a list of all my Games and Appz saved to a notepad. i have many. of course i can Alphabetize manually. but i wonder is there a program that will do it for me. i cant find one
    from the command prompt or batch file:
    sort unsorted.txt /o sorted.txt

    type sort /?
    for more help

  6. Software & Hardware   -   #16
    Poster
    Join Date
    Mar 2003
    Posts
    3,582
    Ah! very good. I knew there had to be a command for that somewhere. I just wish I knew the rest of them.
    Thanks!

  7. Software & Hardware   -   #17
    Poster
    Join Date
    Dec 2003
    Location
    ...Glass tubes all look alike from the inside.
    Posts
    142
    theres a basic sort command? damnit... when did that appear?
    Heck, if i'd known about that back when i wrote qbasic stuff it would have saved a lot of time...

  8. Software & Hardware   -   #18
    Vargas's Avatar gone fishin'
    Join Date
    Jul 2003
    Location
    the poopdeck
    Posts
    1,878
    Originally posted by Project E-01@30 December 2003 - 03:08
    theres a sort command? damnit... when did that appear?
    DOS 3.3 i believe.

    EDIT: BTW the registry settings to open prompts, IN that folder, with a rightclick is:
    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\shell\Command]
    @="Command &Prompt"
    [HKEY_CLASSES_ROOT\Directory\shell\Command\command]
    @="cmd.exe /k cd %1"

  9. Software & Hardware   -   #19
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    lol man u guys went thru a lot of trouble.... oh well

    btw...just copy the list of words into Word and then sort em....from A-Z

    voilą

  10. Software & Hardware   -   #20
    Poster
    Join Date
    Mar 2003
    Posts
    3,582
    does that retain the formatting? I don't know how he's added the info to the text but mine are all date/filename/extension/attributes/description/location

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •