CSVsortU 1.23 (c) 2011-2017, Horst Schaeffer


CSVsort.exe is a console sort tool for CSV lists (CSV: comma separated values).
See also: http://en.wikipedia.org/wiki/Comma-separated_values

The list is sorted in memory, i.e. you should have enough RAM for the file
(overhead per line: two 32/64 bit linked list pointers).
Note: internal UNICODE handling, i.e. 2 bytes per character. 

Lines (records) may be terminated by CR or CR+LF, but will always be written 
with CR+LF.

The fields of each record (the "values") are sorted as text strings with left 
aligned comparison. For (unsigned) numeric strings with variable length the 
"right alignment" option is required (see below).   

The separator character does not have to be a comma (see option /S).
For records with fields enclosed in ("double") quote marks command option /Q
is available.

Unicode (UTF-8/16) files are supported with BOM identifier or command option 
/U8 or /U16. Default is ANSI (byte character files). The result will always be 
written according to the source format.

CSVsort supports multiple sort criteria, which means you can specify 
several fields to sort. If the values for the first criterion are equal, 
the next criterion will be evaluated etc..

+++

Syntax:  CSVsort.exe SourceFile [ProductFile] Parameters

Default ProductFile = SourceFile (overwriting!)
If you have file paths with non-ASCII characters in your CMD script, 
pls. read note about code pages (below).

Sort parameters (up to 16); each one consists of:
   slash 
   comparison option (default: by code value)
      c  regional character handling (proper order for non-ASCII letters)
      i  case ignored (includes option c)
      r  compare right aligned (numeric; prices, for example)
   ascending (+) or descending (-) order 
   field number 1.. 

Examples:
  /i+3     regional character set, case ignored, ascending by field #3
  /-2      code order, descending by field #2
  /r+8     numeric, ascending by field #8 

Numeric comparison: different length of strings determines less/greater; 
strings with same length are compared as text strings.


Command options:

/Ss 
   Separator (default is semicolon) specified by..
   character - example: /S,  (comma)
   or ASCII value - example: /s9 (TAB character)
  
/Hn
   n header lines to leave untouched, example: /h1

/T
   Time (milliseconds) including read/write; output to console 

/Q
   Fields enclosed in quote marks ("one";"two";..) are handled properly, even
   if separator characters occur inside. The qoute marks are removed before 
   comparison, and double quote marks ("") inside are reduced to single (").
   This option requires balanced (i.e. even number of) quote marks!
   
/U8 /U16   
   Assume Uniode source UTF-8 or UTF-16; not required if determined by BOM
   (see http://de.wikipedia.org/wiki/Byte_Order_Mark )
   
Important: each slash must be preceded by at least one space; no commas!

Comand Example:
   CSVsort.exe MyList.csv Product.csv /s9 /i+1 /r-3 /H1

+++

Code page issues:

If you write your CMD scripts (batch files) with a Windows text editor,
and commands or file paths contain non-ASCII characters, then see file 
"codepage.txt".

+++

History:

05 May 2017 - ver. 1.23 - Bugfix Separator option (as character)
              ANSI version (byte characters internaly) no longer supported
17 Mar 2013 - ver. 1.22 - Option /Q for fields enclosed in quote marks
13 Mar 2013 - ver. 1.21 - separate Unicode program version; bugfix (64 bit)
08 Mar 2013 - ver. 1.20 - first public release


Copyright, Disclaimer:

This program is distributed as "freeware," copyright reserved by the author.
There are no warranties of any kind, nor any liability by the author. 
Users accept full responsibility for the use they make of the software and
for any damage caused thereby.

Source available: http://www.horstmuc.de/source/csvsort123.zip

*** 05 May 2017
mailto:horst.schaeffer@gmail.com
http://www.horstmuc.de/

    
                  
         
         
         


