Microsoft KB Archive/104731: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - ">" to ">")
 
(One intermediate revision by the same user not shown)
Line 49: Line 49:
== SUMMARY ==
== SUMMARY ==


SORT adds an extra character to the end of the file being sorted if an end-of-file (EOF) or carriage return (<CR>) character is missing from the end of the file.
SORT adds an extra character to the end of the file being sorted if an end-of-file (EOF) or carriage return (<CR>) character is missing from the end of the file.


</div>
</div>
Line 56: Line 56:
== MORE INFORMATION ==
== MORE INFORMATION ==


Some text editors don't automatically add a &lt;CR&gt; or EOF character to the end of the file (unlike MS-DOS Edit).<br />
Some text editors don't automatically add a <CR> or EOF character to the end of the file (unlike MS-DOS Edit).<br />
<br />
<br />
If you use this type of editor and your file doesn't have a trailing &lt;CR&gt; or EOF character, your sorted file contains an extra character. For example, if you sort the following file (which does not have an EOF or &lt;CR&gt; character at the end of the file)
If you use this type of editor and your file doesn't have a trailing <CR> or EOF character, your sorted file contains an extra character. For example, if you sort the following file (which does not have an EOF or <CR> character at the end of the file)
<pre class="fixed_text">  AA&lt;CR&gt;
<pre class="fixed_text">  AA<CR>
   BB&lt;CR&gt;
   BB<CR>
   CC&lt;CR&gt;
   CC<CR>
   AA
   AA
                 </pre>
                 </pre>
with the command SORT &lt; TEXT.TXT &gt; TESTOUT.TXT, your sorted output is
with the command SORT < TEXT.TXT > TESTOUT.TXT, your sorted output is
<pre class="fixed_text">  AA&lt;CR&gt;
<pre class="fixed_text">  AA<CR>
   AAx&lt;CR&gt;
   AAx<CR>
   BB&lt;CR&gt;
   BB<CR>
   CC&lt;CR&gt;
   CC<CR>
                 </pre>
                 </pre>
where x is a random character from memory.
where x is a random character from memory.
Line 77: Line 77:
== RESOLUTION ==
== RESOLUTION ==


To work around this problem, edit the file you want to sort and add a &lt;CR&gt; to the end.
To work around this problem, edit the file you want to sort and add a <CR> to the end.


</div>
</div>

Latest revision as of 17:43, 20 July 2020

Knowledge Base


Article ID: 104731

Article Last Modified on 5/6/2003



APPLIES TO

  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition



This article was previously published under Q104731

SUMMARY

SORT adds an extra character to the end of the file being sorted if an end-of-file (EOF) or carriage return (<CR>) character is missing from the end of the file.

MORE INFORMATION

Some text editors don't automatically add a <CR> or EOF character to the end of the file (unlike MS-DOS Edit).

If you use this type of editor and your file doesn't have a trailing <CR> or EOF character, your sorted file contains an extra character. For example, if you sort the following file (which does not have an EOF or <CR> character at the end of the file)

   AA<CR>
   BB<CR>
   CC<CR>
   AA
                

with the command SORT < TEXT.TXT > TESTOUT.TXT, your sorted output is

   AA<CR>
   AAx<CR>
   BB<CR>
   CC<CR>
                

where x is a random character from memory.

RESOLUTION

To work around this problem, edit the file you want to sort and add a <CR> to the end.

STATUS

Microsoft has confirmed this to be a problem in MS-DOS versions 5.x, 6.0, 6.2, and 6.21. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: 6.22 5.00 5.00a 6.00 6.20 garbage extended ASCII corrupt corrupted symbol

Keywords: KB104731