Microsoft KB Archive/81854

= Using Edlin to Edit Files Too Large to Fit in Memory =

Article ID: 81854

Article Last Modified on 6/14/2004

-

APPLIES TO


 * Microsoft MS-DOS 3.1
 * Microsoft MS-DOS 3.2 Standard Edition
 * Microsoft MS-DOS 3.21 Standard Edition
 * Microsoft MS-DOS 3.3 Standard Edition
 * Microsoft MS-DOS 3.3a
 * Microsoft MS-DOS 4.0 Standard Edition
 * Microsoft MS-DOS 4.01 Standard Edition
 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a

-



This article was previously published under Q81854



SUMMARY
Edlin can be used to edit files that are of any size. Using the write (W) and append (A) commands within Edlin, you are able to load and edit portions of a file one at a time (that is, load, edit, write to disk, load another segment, edit, write to disk, and so on).



MORE INFORMATION
When you start Edlin in MS-DOS 5.0, it reads lines from your file until memory is 75 percent full. (Many previous versions of MS-DOS restrict the amount of the file that can be read to about 64K minus the size of the Edlin program file.) To edit the remainder of the file, you first have to write an equivalent amount of lines in memory to disk and then load the rest of the file, as follows:
 * 1) Write a set amount of lines to the disk, using the W command. W will write all of the current lines to disk, clearing them from the memory buffer. Once written, the lines are no longer in memory to modify. If you want to specify a certain number of lines to be written, use &quot;nW&quot;, where n is the amount of lines to be written from memory to disk.
 * 2) Use the Append command to load the rest of the file [or as much as can be read]. To specify a certain number of lines to be read, specify &quot;nA&quot;, where where n is the number of lines to be loaded from disk to memory.

Repeat these two commands until you are finished editing the entire file.

Tips
  Whenever you write to the disk, it renumbers the lines of the file that are in memory, starting with 1.

For example, writing 2 lines of a 10 line file from memory to disk: Ten lines of the        Write to disk          Only eight lines of the file in memory ->          2W          ->      file remain in memory starting at 1.

1: @echo off                                   1: prompt $p$g 2: path=c:\dos                                 2: set temp=c:\dos 3: prompt $p$g                                    .. 4: set temp=c:\dos                                ..  Specify the same number of lines that will be written to disk as will be appended to memory. This way, you can keep track of where you are in a file. (Try writing and appending 50 or 100 lines, for example, 50W and 50A.) After Edlin reads the last line of the file into memory, the message &quot;End of input file&quot; is displayed. After editing that portion, you can use the Exit command to exit Edlin and save the rest of the file. Remember that this process is one way, from the front to the end of the file. To edit a portion that has already been written to disk, you have to quit the session of Edlin and start from the beginning again.

When the MS-DOS 5.0 Editor is started using the EDIT command, it occupies about 289K of RAM. The largest size file that can be edited using Editor is about the largest executable program size (as reported by MEM or CHKDSK) minus 289K. For more information on the largest size file that Editor can modify, query on the following words in the Microsoft Knowledge Base:

largest document size

Additional query words: 3.x 4.x 5.00 5.00a

Keywords: kbdownload KB81854

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.