Alphabetically sort file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
keyboard1333
Posts: 21
Joined: 23 Aug 2012 00:07

Alphabetically sort file

#1 Post by keyboard1333 » 24 May 2013 22:37

Hey all :)
I have a simple script that writes text to a file.
What I'd like to add, is the ability to sort each line of the file alphabetically.

So say I have

Code: Select all

alpha
charlie
bravo


the script would re-order it to

Code: Select all

alpha
bravo
charlie


Thanks!
keebs

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Alphabetically sort file

#2 Post by foxidrive » 24 May 2013 22:48

Code: Select all

sort <"filein.txt" >"fileout.txt"


Type sort /?
to see the switches.

keyboard1333
Posts: 21
Joined: 23 Aug 2012 00:07

Re: Alphabetically sort file

#3 Post by keyboard1333 » 25 May 2013 18:23

Wow, so simple :p
Thanks heaps :)

Post Reply