Dec 142017
Large text file editor and viewer.
File CMEDIT31.ZIP from The Programmer’s Corner in
Category Word Processors
Large text file editor and viewer.
File Name File Size Zip Size Zip Type
CM_EDITR.COM 18120 10711 deflated
CM_EDITR.DOC 15271 5561 deflated
CM_EDITR.REG 7059 2404 deflated

Download File CMEDIT31.ZIP Here

Contents of the CM_EDITR.DOC file

* *
* CM_EDITR -- Version 3.10 *
* *

At the DOS prompt, type:

CM_EDITR filename [optional switches]

where filename is the name or full specification (path+name) of the
file you wish to edit. Optional switches, which need not be separated
from one another, are V for view-only, no edit; M for monochrome color
set; and L for LCD color set. (Default color set is for CGA/EGA/VGA.)

Thus, to view a file called TEST.ASC in the DOCS directory of you C drive,
using the monochrome color set, with CM_EDITR on the disk in A drive,
enter at the A:\> prompt:


Feel free the rename CM_EDITR.COM to CE.COM for brevity.

Begin by viewing any text file.


Record Delimiters. . .

The default display mode for "record delimiters" [carriage return
(CR), line feed (LF), and the combinations CR+LF and LF+CR] is to show
their color values, which are cued in the legend at the bottom (blue=CR,
green=LF, cyan=CR+LF, magenta=LF+CR). In addition , the end of the file
is denoted with a red End-of-File (EOF) mark. Sometimes it is very useful
to know exactly what delimiter combination your word processors use, so
you can duplicate it when you edit with CE. You can toggle the colored
delimiter symbols off with "-" and back on with "+". (This is
also covered in a three-page help screen you can get by pressing H.)


Information Area. . .

The name of the file being viewed is shown in the lower left prompt
area. The lower right prompt area shows the ASCII value of the character
at the cursor (decimal and hex), the position of that character in the
file (starting with 1), the file record the cursor is in, and the
position of the cursor within the record (called "Column", which for a
long record is not necessarily the same as the screen column).


Cursor Movement. . .

The arrow keys move the cursor one line up or down and one
character left or right. move left or right
one word at a time, and move to the beginning
or end of the line, as in PCWrite.

For lines longer than 80 characters, only the first 80 are shown
on the screen. To see more of the line, put the cursor on the line,
and move right with or . When the cursor
reaches the end of the screen, the line shifts 20 spaces left, and
keeps doing so until you get to the end of the line -- ie, to the next
record delimiter. For non-ASCII-text files, like graphics files, there
can be a LOT of stuff between bytes of data that
happen to have a value of 10 or 13 (ASCII codes for LF and CR).

moves the display up or down 20 records, and leaves the
cursor on the same video line. moves the display by
200 records (10 video pages) for fast paging through a file. moves
to the bottom of the current page; moves to the top. B moves
to the Beginning of the file contents in memory; E moves to the End.

For very LONG files, exceeding available memory, the editor loads
only as much as fits. When you get to the end of that section (i.e., the
current "file contents in memory" referred to above), the next operation
that asks for another page or line causes the editor to load in the next
section, remembering the file position of the start of the previous
section so it can backtrack if you want. (It actually loads the next
section with some overlap to the previous section, so that a little bit
of backtracking does not result in reloading the whole previous section.)
This "heel-and-toe" sequential loading is limited to 50 sections.


Find a String. . .

Want to look for a particular word or string of characters? The
key combination F (for "Find") opens up a data window at the
bottom for you to enter a short string. After you press , CE
will find the first appearance of the string from the current cusor
position, and put the cursor on it. X (for "neXt") finds the
next appearance, and can be used repeatedly until the string no longer
appears, which is signalled at the bottom of the screen. The search
process starts at the cursor location and goes, if necessary, to the end
of the current file contents in memory.

If the file is long and is being viewed by the editor module in
sections as discussed above, only the CURRENT section is available to the
Find operator. Also, the search is case-sensitive. For example, the
search string "mark" will not find the text string "Mark". The work-
around for this is to use as the search string all but the first letter
of a word that might be capitalized.


Leading and Trailing Blanks in the Data Window. . .

The data entry routine truncates leading and trailing blanks, but
blanks may be included as leading or trailing characters by enclosing the
string at either or both ends with double quotes ("). Suppose, for
example, you wanted to find all of the appearances in a file of the word
"mark", but not "remark". Press F and, in the data entry window
enter: >" mark <. This works for the replace string as


Editing a File. . .

Exit CE from view mode with or . Now you are ready to
edit! Pick a file you can afford to modify, and run CE again with that
file's name or spec on the command line, but don't set the V switch.


Edit Mode Limitations. . .

CE permits edit mode only if the file fits all at once into available
memory, has fewer than 16,380 records, and has no record longer than 8190
bytes. CE will revert to view mode if these conditions are not all
satisfied. If you have a lot of memory tied up in resident programs or
RAM disk/cache, then you may not be able to edit extremely large files.
Chances are, however, that this will never be a practical limitation.


Overstrike vs Push Right. . .

Look at the lower right. If you see "Edit Mode = Overstrike", or
"Edit Mode=Push Right", then CE is in edit mode. Toggle between "Push
Right" and "Overstrike" with the key. Typing action is just
like any word processor. In overstrike mode, the key does not
pull the text left. This is to avoid unintentionally shortening the file
when editing length-sensitive files, such as .COM and .EXE files.


Editing a Line. . .

You operate on a line at a time, and the "normal" editing keys
work -- i.e. , , , , the unmodified and
modified arrow keys discussed above, and any ASCII-code keys. To
create a new line, just to the beginning or end of the
current line, depending on whether you want the new line above or
below the current one, and hit . This inserts the default
delimiter combination, CR+LF, into the text to set up a new line void
of text, but ready for you to start typing. The combination

gives you a menu screen from which you may select a
different record delimiter. Join two lines by deleting the record
delimiter at the end of the first line to be joined. Delete a line
with Y. Delete from the cursor to the end of the line with
D. Delete a word and its associated whitespace with T.


More on Record Delimiters. . .

On CGA/EGA/VGA monitors, the record delimiter appears as a single
colored "blank" character at the end of the line, whether it is actually
two characters (eg., CR+LF) or one (eg., LF). It may be deleted to join
two lines, but not over-struck -- it always pushes right, even when
you are in overstrike mode. The red "End-of-File" (EOF) marker is not
actually part of your file, but rather is only a visual aid for you to
see where the text ends. When the cursor is on the EOF marker, the
"byte number" in the legend corresponds to the number of the next
character, if you were to type one. The EOF marker also always pushes
right, and cannot be deleted. The height of the cursor shows the
status of the "Caps Lock" switch.


Keypad and N. . .

Any ASCII code from 1 through 255 can be entered from the numeric
keypad using the key modifier. A special combination is provided
for ASCII zero ("NULL"), since "0" is not recognized by any keyboard
drivers I have seen. It is "N" (for "Null").


Block Operations. . .or CE's REAL Power. . .

All the block operations -- there are six -- are keyed to key
combinations, and they are all intuitive (sort of). They are:
{ Mark, Y(delete), moVe, Copy, Print and Output }.


Marking a Block, and the Copy Buffer. . .

You may also manipulate blocks of records. First mark a block by
putting the cursor on the first (or last) record of the block you want
to do something with, press M (for "Mark"), move down (or up) with
arrows, , etc., and mark the last (or first) record of the block,
again with M. The marked text is written into a copy buffer for
later use. If you made a mistake, a third press of M clears the
marks, but leaves the copy buffer intact. The contents of this copy

When you are marking a block, note that the information box at the
bottom left of the screen expands to show you the attributes of the
marked block -- the number of the first and last records marked, and the
number of bytes in the painted area. There is an arbitrary 32 KB limit
on the copy buffer.


Delete, Copy, Move. . .

Delete the block with Y ("Y" being the nearly universal key
meaning "delete"). Or put the cursor in an unpainted area of the
file, and copy the block into that area, just ahead of the line where
you put the cursor, by pressing C (for "Copy"). Or move it with
V (for "moVe"). As noted above, the block previously "marked" into
the copy buffer is available for multiple use. Just put the cursor where
you want the block to be copied and hit C again.


Restoring from Inadvertent Block Deletion. . .

If you just deleted a block in error, put the cursor where you want
to restore it, and press C to copy the buffer back into the file.


Sending a Block of Text to the Line Printer. . .

Print the copy buffer to line printer 1 (the parallel port) with
P (for "Print"). After printing, if you want a form feed, press
F (for "Form feed" -- note the use of vice as the
modifier key, since F was already used for "Find").

. . .or to a File. . .

Finally, output the copy buffer to a file in the same path as the
file being edited by pressing O (letter "O" for "Output"). A
window opens at the bottom for typing the name of the file for CE to
create (if it doesn't already exist) or append to if it does. (The file
will be created or opened in the current directory on the default drive.
Therefore the characters ":" and "\" will not be recognized.)


Replace and Global replace. . .

In addition to the F "find" feature, there is an R
"replace" and an G "global replace" feature. Just press R or
G and enter the find and replace strings when prompted. (If you see
a mistake in the find string while you are typing the replace string,
just arrow back up a line and reedit it.) For R, CE will find the
first match and ask you to confirm the replacement. It continues finding
and requesting confirmation until you press Q (for "quit replacing").

X reactivates either the find or replace routine, whichever was used
last. G replaces all appearances of the find string with no
confirmation. It may be terminated with any key press. When global
replace was thus terminated, X reactivates the confirmatory replace,
not the global replace.


Leaving the Editor. . .

After editing is complete, press . The next prompt you get
asks whether you want to save this edit (y/n), or go back to the editor
(). (If you had hit the key by mistake, hit it again to
return to where you were.) In some cases you botched the file up so bad
you don't want to save it, but most of the time you do. Press "Y". The
next prompt wants to know if you want to save the original, pre-edit
version of the file as "*.BKP" (an arbitrary extension designator I
picked to show the file as a "BacKuP" from edit mode, different from the
form of the backup extension assigned by the backup command "B" from the
main module.) If you say no, the edited version will simply overwrite
the original. If you say yes, then the previous backup file with the
same name and extension ".BKP", if there is one, will be deleted, the
"current" original file will be renamed with the ".BKP" extension, and
the now-edited version will be saved under the original name. If CE runs
out of file space, it will ask you to put a NEW disk into drive A to save
the edited version.


Backup File Protection. . .

A small point of backup file protection. If, in the process of
saving the original version of the edited file, CE encounters a file
with the same name and the ".BKP" extension, it will simply overwrite
it, UNLESS it is assigned the read-only attribute and the original to
be renamed and saved is not. In this case CE will give you the option
of saving the read-only file.


Help. . .

A one-page help screen may be summoned on-line at any time in the
editor with the command "H", and exited with any keystroke.

 December 14, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>