[Overview] [Features] [Users' Review] [Screenshot] [Example 0 (basic usage)] [Example 1] [Example 2] [Example 3 (CSV file)] [Example 4 (CSV file with empty fields)] [Download] [Donation] [Other Freeware] [Home]
If at least one answer is "yes", then you should take a look at CMSort, a freeware 32-bit command line sort utility for Windows XP/Vista/7/8.x/10 (both 32 and 64 bit versions). An additional advantage of CMsort is its capability to handle not only text files with DOS/Windows end-of-line-marks, but also files with UNIX, MAC, or even mixed (!) end-of-line marks!
The new versions since 2.01 offer increased speed (up to 3-10 times faster), allow sorting of files greater than 2 GB and have the additional capability to sort CSV files.
If you have any questions or comments, feel free to
contact the author.
Note: CMsort uses the quicksort algorithm. Therefore, it's not a stable sort.
[Top]
I am sorting a very large file and I was very happy that CMSort could sort it at all, and in a very reasonable amount of time. [...] CMSort is well documented (for example, the separate PDF with several examples of proper syntax, versus other software providing a single web page, or only the text display when typing a "/?" option). Because of the good documentation, I could quickly read and correctly understand and use your program. Also CMSort seems to be well-written, without any bugs or crashing that cause the program to not work as expected. [...] Your CMSort sorts not just plain text files via column position, but very usefully, CSV files by ordered field. Maybe there are many other sort programs that handle CSV files, but most of the alternatives I could try sort FIXED COLUMN text files, not CSV. My strategy for sorting CSV files in the past was to use [name of a spreadsheet application], but the old version had a limit of 65,000 rows; newer versions allow 1 million rows. My large file has 16 million records. So I was also trying another strategy of converting the CSV file to a fixed width file. Because I own a very good text/programmer's editor [name of text editor] with a cool feature to convert CSV files into fixed width files. However, this worked well on small files. When I ran it on my very large 3GB file... it ran for 8 days (not a typo - I left it running for 24 hrs by 8 days on a quad-core PC, before I killed the process, at maybe about 70% completion). [...] So my main argument is that CMSort is easy and QUICK to understand, works reliably, handles a wide variety of cases and file types or situations, is free and well documented. [...] Again, thank you for your software.
On June 28, 2001 I received the following mail:
I just wanted to drop you a line to congratulate you on a superb piece of work when it comes to CMSort. I had a large file (130,000,000 bytes - 10,000,000 records ... each a digit from 0 to 999,999,999) which nothing I had would sort. I could play with it in Access97, but nothing else would touch it (and Access didn't like it). So, since the file was created, and managed with Visual Basic (which worked quite well for generating and picking out some data), I didn't feel like writing a homegrown sorting algorithm (I'm experimenting with random numbers, and a means of generating unique values which resulted in the file in question...) Anyhow, your software clocks in at 18 minutes and 16 seconds to sort my data. (I'm running a PII 300, and I used the default settings, ie. CMSort <infile> <outfile>). Very impressive! To think, I was just impressed that the program made it through the data (I ran out of patience with Access97 and killed the process after close to an hour... it wasn't getting anywhere and it was slowing my machine down!) So, to make a long story short... Thanks! You made my day.
[Top]
[Top]
REM Sort key is complete line case sensitive ascending (default) cmsort /S data.txt data.sor REM because this is the default, you can simply type cmsort data.txt data.sor REM Sort key is complete line case insensitive ascending cmsort /C data.txt data.sor REM Sort key is complete line case sensitive descending cmsort /S- data.txt data.sor REM Sort key is complete line case sensitive descending cmsort /C- data.txt data.sor
[Top]
1234567890123456789012345678901234567890123 Cust. Name Order Return No. Date 1004711 Miller & Co. 1999-12-06 1,207.23 1004713 Topsoft 2000-01-04 2,521.95 1004747 MCP & Co. 2000-01-04 7,356.88 1004799 Eftpos 1999-12-06 23,122.56 Execution of cmsort /H=3 /S=22,10 /N=33,11- CUSTOMER.TXT CUSTOMER.SORwill sort this file by order date (ascending) and return (descending). The result is:
1234567890123456789012345678901234567890123 Cust. Name Order Return No. Date 1004799 Eftpos 1999-12-06 23,122.56 1004711 Miller & Co. 1999-12-06 1,207.23 1004747 MCP & Co. 2000-01-04 7,356.88 1004713 Topsoft 2000-01-04 2,521.95Explanation of command line arguments:
/H=3 | don't sort three header lines |
/S=22,10 | first part of key is a string, beginning at position 22, length 10 bytes, sort ascending (default) |
/N=33,11- | second part of key is numeric, beginning at position 33, length 11 bytes, sort descending (-) |
[Top]
055 Maas 2001-02-05 07:31:55 087 Mechenbier 2001-02-05 08:01:23 024 Hesselbein 2001-02-05 08:15:16 055 Maas 2001-02-05 08:44:24 089 Kruft 2001-02-05 09:05:07 087 Mechenbier 2001-02-05 09:31:13 Execution of cmsort /S=1,3 /D LOG.TXT LOG.SORwill sort the log file by user ID (ascending) without duplicates. The result is:
024 Hesselbein 2001-02-05 08:15:16 055 Maas 2001-02-05 08:44:24 087 Mechenbier 2001-02-05 09:31:13 089 Kruft 2001-02-05 09:05:07
[Top]
"Customer No";CustName;OrderDate;Return 1004711;Miller & Co.;1999-12-06;1,207.23 "1004713";"Topsoft";"2000-01-04";"2,521.95" 1004747;MCP & Co.;2000-01-04;7,356.88 1004799;Eftpos;1999-12-06;23,122.56This is the command line to sort by order date ascending and by return descending without the header line:
cmsort /SV=3,1,0 /NV=4,1,0- /V /H=1 customercsv.txt customercsv.sorThis is the resulting file:
"Customer No";CustName;OrderDate;Return 1004799;Eftpos;1999-12-06;23,122.56 1004711;Miller & Co.;1999-12-06;1,207.23 1004747;MCP & Co.;2000-01-04;7,356.88 "1004713";"Topsoft";"2000-01-04";"2,521.95"
[Top]
Euclid;;Greek Thales;;Greek Banach;Stefan;Polish de Fermat;Pierre;French Cantor;Georg;GermanCommand line to sort by first name ascending:
cmsort /V /SV=2,1,0 csvempty.in csvempty.sorResulting file:
Thales;;Greek Euclid;;Greek Cantor;Georg;German de Fermat;Pierre;French Banach;Stefan;Polish
[Top]
CMsort is freeware. However, if you like CMsort, want to appreciate my work, and/or support the development, I would be pleased to receive a donation from you via PayPal. | ||
Click the button below to make a donation via PayPal in US$: | Click the button below to make a donation via PayPal in EUR: | |
[Top]