Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a txt file with ca. 3000 name entries on each line. I want to list them in alphabetical order. Is there any way i can do this via some text editor so that i don't have to manually go through all the names in the list?

Thanx in advance!

share|improve this question

PSPad has a line sorting feature: Edit -> Sort...

ConTEXT has a similar sorting feature.

Or if you can cope with Vim, that has a built-in sort command which works on a range of lines, or on the selected text.

share|improve this answer

You can use a simple command that's included with Windows XP (as that's what I'm assuming you're running from your tag) called sort.

It's as simple as running sort FileToSort.txt /o OutputFile.txt in cmd [replacing FileToSort.txt with the file you want sorted and OutputFile.txt with the name of the file you want to output] (start -> run -> cmd; see here for more examples and usage).

share|improve this answer
    
You know, I have been using Windows for years and years. I knew about the Unix sort command, uniq, etc. but never once thought to try it on Windows! – Joshua Apr 2 '10 at 0:59
    
"sort in.txt out.txt" doesn't work. You'll need to use "sort in.txt /o out.txt" or "sort in.txt > out.txt" – Bavi_H Apr 2 '10 at 1:07
    
@Bavi_H: Thanks, answer revised to reflect your comment. – squircle Apr 2 '10 at 15:12

If you want to write a program...

pseudocode (assumes each name is on its own line):

names as List of Strings
while(!file.eof)
{
    names.Add(file.readline());
}

names.Sort();
share|improve this answer
    
this would be a better fit if the question were asked on SO. just a thought. – squircle Apr 2 '10 at 0:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .