I don't know what just happened, but the code just made sense!
So the logic is to copy the data from the column that needs to be sorted to the front of each row, and then use regular sort to sort the resulting data.
So to sort based on two columns, data from both sort columns needs to be copied to the front of each row, and then the first two columns need to be stripped off. If my guess is right, the code would look something like this (based on Dave's algorithm):
Code: Select all
@echo off
(
for /f "tokens=1-3* delims=," %%A in (test.csv) do @echo(%%C,%%B,%%A,%%B,%%C,%%D
)|sort|for /f "tokens=1* delims=," %%A in ('findstr "^"') do @echo(%%C
I'll try to implement this in the next hour or so and see what happens.
