PDA

View Full Version : Some Way To Alphabetize A List Of Words



Kevhead2
12-29-2003, 03:36 AM
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

balamm
12-29-2003, 03:40 AM
At a command prompt,




Microsoft Windows 2000 [Version 5.00.2195]
© Copyright 1985-2000 Microsoft Corp.

C:\>dir /?
Displays a list of files and subdirectories in a directory.

DIR [filename] [/A[[:]attributes]] [/C] [/L] [/N]
[/O[[:]sortorder]] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
[/b]

Another appliacation which may interest you is SetupDIRlist

It creates an index.html in each folder you open it in. Your files will be listed alphbetically and will appear on the index as hyperlinks. Very cool for music folders! Click and play, click and run.

Kevhead2
12-29-2003, 03:49 AM
Got it ... Thnx balamm

sparsely
12-29-2003, 05:56 AM
I'm gonna have to try that setupDIR app...sounds handy.
thx balamm

balamm
12-29-2003, 06:03 AM
It works great, just do each folder, then back out and do the main directory, then the partition. Your whole drive is now hyperlinked just like a website. Just be carefull opening it, it will over write any existing indexes in the folder it opens to.
I use this on quite a few CD's I burn to make it easier to find stuff. Put everything in a folder, create the index, then create a shortcut o it and place the shortcut outside the folder. Burn it all and when you open the CD, it's all indexed. Just click on the app or file you want.

Kevhead2
12-30-2003, 12:53 AM
Originally posted by balamm@29 December 2003 - 03:40
At a command prompt,




Microsoft Windows 2000 [Version 5.00.2195]
© Copyright 1985-2000 Microsoft Corp.

C:\>dir /?
Displays a list of files and subdirectories in a directory.

DIR [filename] [/A[[:]attributes]] [/C] [/L] [/N]
[/O[[:]sortorder]] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.


Another appliacation which may interest you is SetupDIRlist

It creates an index.html in each folder you open it in. Your files will be listed alphbetically and will appear on the index as hyperlinks. Very cool for music folders! Click and play, click and run. [/b]
IM having a problem getting the Attributes to take effect.

I can Open C:\Documents and Settings\Dell PC\My Documents\Games.txt

By typing that into Run Command.


But to Alphabetize it, i have tried

C:\Documents and Settings\Dell PC\My Documents\Games.txt/O:N

C:\Documents and Settings\Dell PC\My Documents\Games.txt/A/O:N

And a few other usless combinations and i get a "Windows cannot find"

Anyone know What is the proper command at the end of

"C:\Documents and Settings\Dell PC\My Documents\Games.txt"

to get that Games.txt to Alphabetize?

Project E-01
12-30-2003, 12:58 AM
Lol. DIR is a dos based command that you use to list the contents of a directory. Its no good for what you want... :)

Seriously, type DIR /o in that command prompt and you'll understand.

My advice would just be to open the text file in Access or something and sort it from there. Or you could set up a basic routine to do it - its only a half dozen lines of code or so.

Kevhead2
12-30-2003, 01:01 AM
Originally posted by Project E-01@30 December 2003 - 00:58
Lol. DIR is a dos based command that you use to list the contents of a directory. Its no good for what you want... :)

Seriously, type DIR /o in that command prompt and you'll understand.

My advice would just be to open the text file in Access or something and sort it from there. Or you could set up a basic routine to do it - its only a half dozen lines of code or so.
Yes i just noticed that after i sent the message. but i have also just tried the same cammands at the Does Prompt

C:\Windows\System32\command.com and the same commands are not working there either

Kevhead2
12-30-2003, 01:06 AM
At Run i typed "command" at command i typed DIR o/ then i typed the path to the games.txt

And i added /O:N to the end of it.

Not working

balamm
12-30-2003, 01:07 AM
Where are the programs you want to list? If they are in a directory somewhere, You open the command prompt there and list the contents in alphabetical order. Then copy the results and paste that into notepad.



Opening a Command Prompt from Windows Explorer




Submitted by Dan Green
Sydney, Australia

With previous versions of Microsoft Windows NT, to open a command prompt, the Cmd.exe command was always associated with Windows Explorer folders. The old technique was to go to the Windows NT Explorer Options/File Types and associate the File Folder item with Cmd.exe. With Windows 2000, you can use the Registry to activate this feature.
To enable the command prompt feature:
1. Create a new text file and call it "command.reg" (select any appropriate name for the .reg file).
2. Right-click the file and select Edit.
3. Copy and paste the following code into the file.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Command]
@="Command &Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\Command\command]
@="cmd.exe \\\"%1\\\""
4. Save and close the file.
5. To merge the file into the registry, right-click the file and select Merge.
6. When prompted to confirm your intended actions, click Yes.
7. When informed that your actions were successful, click OK.
To confirm your actions:
1. Right-click on a folder.
2. Confirm that an item labelled Command displays.
3. Select that item which will open a command prompt in that particular directory.

Project E-01
12-30-2003, 01:31 AM
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.



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. :)

Project E-01
12-30-2003, 01:36 AM
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.

Kevhead2
12-30-2003, 02:23 AM
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

balamm
12-30-2003, 02:32 AM
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.

Vargas
12-30-2003, 02:48 AM
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

balamm
12-30-2003, 02:53 AM
Ah! very good. I knew there had to be a command for that somewhere. I just wish I knew the rest of them.
Thanks!

Project E-01
12-30-2003, 03:08 AM
theres a basic sort command? damnit... when did that appear?
Heck, if i&#39;d known about that back when i wrote qbasic stuff it would have saved a lot of time... <_<

Vargas
12-30-2003, 03:15 AM
Originally posted by Project E&#045;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&#092;Directory&#092;shell&#092;Command]
@="Command &Prompt"
[HKEY_CLASSES_ROOT&#092;Directory&#092;shell&#092;Command&#092;command]
@="cmd.exe /k cd %1"

DWk
12-30-2003, 04:30 AM
lol man u guys went thru a lot of trouble.... oh well :D

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

voilą :D

balamm
12-30-2003, 04:35 AM
does that retain the formatting? I don&#39;t know how he&#39;s added the info to the text but mine are all date/filename/extension/attributes/description/location

DWk
12-30-2003, 04:45 AM
what formatting? i thought it was a list of WORDS (or titles of games and appz....)

either way... you can check maxlister.... it doesnt alphabetize but it lists all files.... its pretty good :)

http://www.tucows.com/preview/217899.html

have fun :)

Vargas
12-30-2003, 11:56 AM
Originally posted by balamm@30 December 2003 - 04:35
does that retain the formatting? I don&#39;t know how he&#39;s added the info to the text but mine are all date/filename/extension/attributes/description/location
well if youre asking me... sort can sort by filename even if date comes first, by useing the /+ peramiter:


/+n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Specifies the character number, n, to
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin each comparison. &nbsp;/+3 indicates that
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;each comparison should begin at the 3rd
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;character in each line. &nbsp;Lines with fewer
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;than n characters collate before other lines.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;By default comparisons start at the first
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;character in each line.

quiksilver_aus
12-30-2003, 06:52 PM
i just made a quick little program to sort a list of words/sentances using Visual Basic

you can find my program here:
http://www.freewebs.com/quiksilvers_walls/sort.exe

for this to work, the text file must be labelled "in.txt" and have each of the entries on a seperate line. it must also be placed in the same directory as the "sort.exe". this will produce an output file labelled "out.txt" which is in alphabetical order.

if you get an error, it&#39;s because you didn&#39;t label the file correctly for the program to detect.