Microsoft KB Archive/70623

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:50, 21 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")

Sort Does Not Expand Tab Characters PSS ID Number: Q70623 Article last modified on 02-08-1993 PSS database name: O_MSDOS

4.01

MS-DOS

The information in this article applies to:
- Microsoft MS-DOS operating system version 4.01

Question:

Sort does not appear to work properly when I attempt to sort a file containing tab characters by columns using the “Sort /+n” command. How does Sort deal with tabs?

Response:

Sort does not expand tab characters into spaces. Instead, Sort treats the tab as one character with an ASCII value of 9. This causes improper sorting of text containing tab characters.

Examples

A text file contains the following lines:

a b<tab> c<tab>c d c

When you sort the text with the /+1 option (default), the output is:

a b c c d c

a < b < c < d

When you sort the text with the /+2 option, the output is:

b c c a d c

<tab>+<ret> < <tab>+c < <ret> < <space>

When you sort with the /+3 option, the output is:

a ;line ignored b d c c c

<ret> < <space> < c

When you sort by column /+4, the output is:

a ;line ignored b ;line ignored c c d c

<ret> < <space>

When you sort by column n>5, the output is:

a ;line ignored b ;line ignored c c ;line ignored d c

Additional reference words: 4.01 noupd

Copyright Microsoft Corporation 1993.