Windows 7 : Sorting contents of a file

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


Solution 1:

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

Solution 2:

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.