@rem csvsort.bat @rem RJM Programming - January, 2015 @rem Defaults to three comma separated fields to sort and default csv3.bat and vsc3.bat as written @rem Usage: csvsort[.bat] [[numFields] [rowsToSkip]] inputCSVFilename [fieldNumberOfSort] [/n] [/r] @rem Defaults: /n does numerical sort and /r reverses the sort @rem Defaults: rowsToSkip=0 fieldNumberOfSort=1 (starting at 1) numFields=3 (if specified please also specify a rowsToSkip value) @set three=3 @if trick%1==trick goto nomore @set seo=%1 @if exist %seo% set seo= @if trick%seo%==trick goto bitmore @shift :bitmore @if exist %1 goto yesmore @set three=%seo% @set seo=%1 @shift @if exist %1 goto yesmore @goto nomore :yesmore @if trick%seo%==trick0 set seo= @if exist mytemp.xxx erase mytemp.xxx @if trick%2==trick @csv%three% %seo% %1 | sort | find /V "usebackq " >> mytemp.xxx @if trick%2==trick @goto pastbits @if trick%3%4==trick/r/n @csv%three% %seo% %1 %2 %4 | sort %3 | find /V "usebackq " >> mytemp.xxx @if trick%4%3==trick/r/n @csv%three% %seo% %1 %2 %3 | sort %4 | find /V "usebackq " >> mytemp.xxx @if trick%3%4==trick/r @csv%three% %seo% %1 %2 %4 | sort %3%4 | find /V "usebackq " >> mytemp.xxx @if trick%3%4==trick/n @csv%three% %seo% %1 %2 %3%4 | sort | find /V "usebackq " >> mytemp.xxx @if trick%3%4==trick @csv%three% %seo% %1 %2 | sort | find /V "usebackq " >> mytemp.xxx :pastbits @vsc%three% mytemp.xxx %2 goto theend :nomore @echo One of first three parameters should have filename %1 :theend