1
From within a DOS batch file, how can I crudely re-sort a text file containing a manually maintained list of source files, so those files listed (from the same directory) in the small example extract below are grouped together again? I don't like how the DOS sort.exe reorders them in pure alphabetical order, where ctype.h and assert.h have been separated by files listed in the c++ sub-directory.
I'd prefer to do this using pure Windows XP/DOS (or Unix) commands - or if needed download an existing executable utility that doesn't need installing like tcl or perl scripts. It's a pity dir /s /b
can't take input from file trying to use it as a format filter, not sure if ls can.
To be reordered after DOS sort.exe has done its mischief:
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\ar.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\argz.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\assert.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\auto_ptr.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\backward_warning.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\binders.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\boost_shared_ptr.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\functional_hash.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\hashtable_policy.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\cr_section_macros.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\ctype.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\dirent.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\envlock.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\envz.h
Desired output:
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\ar.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\argz.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\assert.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\cr_section_macros.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\ctype.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\dirent.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\envlock.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\envz.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\auto_ptr.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\backward_warning.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\binders.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\boost_shared_ptr.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\functional_hash.h
C:\NXP\LpcXpresso_3.6\Tools\arm-none-eabi\include\c++\hashtable_policy.h
Windows XP does not use DOS. Do you mean
cmd
("Command Prompt")? – user1686 – 2011-03-25T15:56:07.607