1
I'd like to sort a text file by the 3rd column of data, not the 3rd character, using pure Windows CLI commands. The commands would be put into a batch file.
The data would look something like
#filename seqno phasename a b c scale Rwp
blah_001.xye 1 corundum 3 3 12 0.001 3
blah_001.xye 1 silicon 5.4 5.4 5.4 0.002 3
blah_002.xye 2 corundum 3.1 3.1 12.1 0.002 3.5
blah_002.xye 2 silicon 5.41 5.41 5.41 0.004 3.5
blah_003.xye 3 corundum 3.2 3.2 12.2 0.001 3.1
blah_003.xye 3 silicon 5.42 5.42 5.42 0.002 3.1
blah_004.xye 4 corundum 3.4 3.4 12.2 0.001 3.2
blah_004.xye 4 silicon 5.43 5.43 5.43 0.002 3.2
blah_005.xye 5 corundum 3.5 3.5 12.3 0.001 3.9
blah_005.xye 5 silicon 5.44 5.44 5.44 0.002 3.9
blah_006.xye 6 corundum 3.6 3.6 12.3 0.001 3.1
blah_006.xye 6 silicon 5.45 5.45 5.45 0.002 3.1
I want to sort by phasename. If would be good if I could keep the first row in place. There will be more than 5 columns after the 3rd, and therer will be more rows than this, but the sorting would always be by the 3rd column.
I've seen this question, but I can't decypher the for commands.
I commend to your attention the extensive information at SS64 on the
– Jeff Zeitlin – 2018-08-01T13:34:08.817FOR
command, or Microsoft's own documentation on theFOR
command, or even the output ofHELP FOR
.