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

Is there any functionality by which I can sort the contents of a file in place in windows 7 ?

I am not sure if there is any way I could do it in UI, but is there any batch script which will help me do it ?

An example of what I am trying to do.

Let file "data.txt" containing the follwing data be the input file

A12
A04
B08
B01

The output data.txt should contain

A04
A12
B01
B08

Basically, something like a natural sort.

How can I achieve this in windows 7

share|improve this question

migrated from stackoverflow.com Sep 5 '11 at 22:30

This question came from our site for professional and enthusiast programmers.

    
What do you mean by sort a file? Sort the contents? By what order? Or do you mean to sort the file list? How do you want to do it, programatically, or through the Windows UI? – Ray Sep 5 '11 at 13:28
    
Made the question more clear. – vinoth Sep 5 '11 at 13:35
    
@cmv: You actually didn't make it any more clear. Ray's questions still stand. What exactly are you trying to do? What kind of file are you talking about? Sort it how? – David Sep 5 '11 at 13:37
    
I edited the question once more. – vinoth Sep 5 '11 at 13:41

windows 7 and much older versions of windows have an exe: sort.exe it makes exactly what you want (as I understud your question) use it as:

sort <data.txt >newData.txt
share|improve this answer

Start a command prompt window.

Type help sort in order to see and then enter the syntax right.

You will find that the command is sort data.txt /o newData.txt.

Check your work by entering type data.txt to display the original data, and then type newData.txt to see the sorted file contents.

share|improve this answer
    
the final command should have been type newData.txt I missed bolding the first word. – reigh Dec 17 '14 at 23:53

You must log in to answer this question.

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