PDA

View Full Version : sorting a case sensative list alphabetically


fluorescenthippo
06-21-2005, 07:28 PM
I have a list of poker notes that i want to sort. each note is seperated by a return. I want to sort them alphabetically by the first word. If the first word is capitalized, it would come before lowercase words.

The list would then look something like this.
A
E
J
W
b
d
o
q

you get the idea. is there a program that will help me do this?

BluffTHIS!
06-21-2005, 10:28 PM
I assume what you want to do is manipulate a party/skin notes file and then be able to put it back the way they make it. I wrote a post about this in the zoo a while back and said that as far as I know neither MS Word or other word processors will alphabetize a list case sensitively. So you are probably SOL unless someone else comes up with an idea. Obviously the party software has a way to do it but I have no idea how. I have also tried using a sort on cells in excel, which should mirror acess, which has a case sensitive option, but what it does is merely put lowercase values immediately in front of corresponding uppercase once for the same letter, not all the lowers first then uppers.

Larimani
06-21-2005, 10:47 PM
Lowercase letters have got different ASCII codes that uppercase ones...

Uppercase is ASCII#65-90 whereas lowercase is ASCII#97-122

It should be relatively easy to write a macro that sorts your list into 2 lists (uppercase and lowercase)... and then you can do an alphabetical sort on both list in Excel.

Unfortunately, my programming skills are too poor to write such macro.

There might be an easier way to do it...

BluffTHIS!
06-22-2005, 12:13 AM
This is a good suggestion and I did a quick google and found this link regarding sorting macros link (http://www.mvps.org/dmcritchie/excel/sorting.htm) though I haven't coded a macro in VBA before and don't know if the example one would do the trick but it seems like it might if you change the match_case arguement to true.

fluorescenthippo
06-22-2005, 02:35 AM
damn. too bad im an electrical engineering major and not a cs one. i have no idea how to use that stuff. someone on 2+2 should make a program for this

Guthrie
06-22-2005, 11:33 AM
It should be easy work for any database application. You just sort on upper(whatever). The upper() function causes the sort to see everything as upper case, but doesn't actually change the data.

I could sort it for you and send it back, but I assume you need something on an ongoing basis.

MrBrightside
06-22-2005, 03:12 PM
I have used a shareware program, UltraEdit (like a super, super, notepad) for years. It will do this.
this:
Abe
bell
bell
fred
Fred
zee

Becomes:
Abe
Fred
bell
bell
fred
zee

you can dl a 30 day trial at www.ultraedit.com (http://www.ultraedit.com)

fluorescenthippo
06-22-2005, 03:48 PM
wow thanks, this is very helpful. i will have to buy this program

tinhat
06-22-2005, 05:18 PM
[ QUOTE ]
I have a list of poker notes that i want to sort. each note is seperated by a return. I want to sort them alphabetically by the first word. If the first word is capitalized, it would come before lowercase words.

The list would then look something like this.
A
E
J
W
b
d
o
q

you get the idea. is there a program that will help me do this?

[/ QUOTE ]

If this is a plain text file and you have access to linux (or GNU tools installed on windows), from a csh prompt type what's bolded (where "list" is your text file name):

% mkdir list.tmp && foreach entry (`cat list`)
foreach? touch list.tmp/$entry
foreach? end && ls -1 list.tmp > list.new

"list.new" contains your results.

If you used emacs you'd simply load the file, set "sort-fold-case" to nil and run "sort-lines". Done.

Mike

MrBrightside
06-22-2005, 05:29 PM
no problem. If you do much maniupluation of text files, it's worth it. I program for a living, and i do most of my programming in this thing. It's got some powerful macro capabilities and there is a nice user community with lots of files to download.

Once, I wrote a macro in about 45 minutes to merge PokerStars notes files from my laptop and desktop (sync them up), for instance. Didn't take too long.