Command: edlin
The edlin program is a small line editor, written for FreeDOS as a
functional clone of the old MS-DOS program edlin. It differs from MS
edlin in that first, it's free software, and second, the user interface
is slightly different in a few places. The reason for the difference is
so that the user does not have to type in control characters mandated
by MS edlin's syntax.
INVOKING EDLIN
The edlin program is invoked either by itself:
edlin
or with a filename that's initially read in:
edlin file
EDLIN'S INTERNAL COMMANDS
In the following command lists:
The [ and ] brackets represent optional values.
The # symbol represents a line number, which can be one of several
possible values:
- A string of digits as a literal line number, such as 12 for
line 12.
- A period "." as the current line in the file.
- A dollar sign "$" as the last line in the file.
- A number "#" as the line number just after the last line in the
file.
- A +n or -n as a count added or subtracted from a line number.
This is useful for relative line addressing, such as .+1 for the
line after the current line.
The $ symbol represents a string of characters. Strings may be
enclosed in either single or double quotes, and may contain the
following escape sequences:
\a - Alert character
\b - Backspace character
\e - Escape
\f - Form feed
\t - Horizontal tab
\v - Vertical tab
\" - Double quote
\' - Single quote
\. - Period
\\ - Backslash
\xXX - Hexadecimal value, where each x is a hexadecimal digit
(0 to F, uppercase or lowercase)
\dNNN - Decimal value, where each N is a decimal digit (0 to 9)
\OOO - Octal value, where each O is an octal digit (0 to 7)
\^C - Control character, such as \^J for the literal "control J"
(linefeed) character.
The edlin program supports the following syntax:
# - EDIT A SINGLE LINE
The edlin program outputs the single line indicated by the number, and
the next inputted line replaces the outputted line in the file.
a - APPEND to the file
This command is equivalent to $+1i .
[#],[#],#,[#]c - COPY A RANGE OF LINES
This command copies a block of consecutive lines to another location in
the buffer. The parameters are, in order:
1. The first line you want to copy (default = current line).
2. The last line you want to copy (default = current line).
2. The line before which you want to insert the block of lines.
4. The number of times you want to copy the block (default = 1).
After copying lines, use the l (list) command to see the new line
numbers.
[#][,#]d - DELETE A RANGE OF LINES
Delete a block of consecutive lines from the buffer. The parameters
are the first and last line of the block to be deleted.
If you omit the first parameter, delete the block from the current
line to the line specified in the second parameter (be sure to include
the comma).
If you omit the second parameter, delete only the line specified in
the first parameter.
Omitting both parameters deletes the current line.
e filename - SAVE AND EXIT
This command is equivalent to w filename followed by q.
This verifies whether the user actually wants to quit before doing so.
To quit, answer the "Abort edit (Y/N)?" prompt with "yes."
[#]i - INSERT LINES
Enter insert mode. Its parameter is the line number before which you
want to insert lines.
While entering text, you can use the escape sequences from above.
To exit insert mode, type . (period) on a line by itself. (If you need
a line with just a period, you need to enter it as \.)
After exiting insert mode, the line after the inserted text becomes
the current line - unless the insertion was appended to the end of
the buffer, in which case the last line in the buffer becomes the new
current line.
[#][,#]l - LIST LINES
List the lines of text to the screen. If you omit the first parameter,
start showing text starting at 11 lines before the current line.
If you omit the second parameter, shows a screen of text beginning
with the line specified in the first parameter.
If you omit both parameters, show a screen of text starting at 11
lines before the current line.
If the number of lines to show is longer than the number of lines on
the screen, edlin will prompt after each screen.
[#],[#],#m - MOVE LINES
Move a block of text to the line before the number specified in the
third parameter. It is similar to copying then deleting the original
block.
[#][,#]p - PRINT LINES
Similar to the l (list) command except that the default parameters
starts at the current line instead of 11 lines before it.
q - QUIT
Quit the program.
This verifies whether the user actually wants to quit before doing so.
To quit, answer the "Abort edit (Y/N)?" prompt with "yes."
[#][,#][?]r$,$ - REPLACE STRING
Replace all occurrences of the first string with the second between
the two lines specified.
If you omit the first parameter, start replacing at the line after the
current line.
If you omit the second parameter, stops replacing text at the last
line of the buffer.
If you include the ? (question mark), edlin will print a confirmation
message before replacing text.
[#][,#][?]s$ - SEARCH FOR A SUBSTRING
Search for the first line containing the specified substring.
If you omit the first parameter, start searching from the current
line.
If you omit the second parameter, stop the search at the end of the
buffer.
If you include the ? (question mark), edlin will print a confirmation
message. Responding "no" to the confirmation message continues the
search; "yes" ends the search.
If the search found the substring, the current line will be set to the
line where the search ended.
[#]t filename - TRANSFER A FILE
Insert the contents of a file before the specified line number.
If you omit the line number, insert before the current line.
[#]w filename - WRITE THE FILE
Write the first # lines in the buffer to the specified file.
If you omit the number parameter, write all the lines in the buffer
to the file.
Author / Maintainer
Gregory Pietsch, gpietsch@comcast.net
See also:
blocek
edit
ospedit
Copyright © Gregory Pietsch, gpietsch@comcast.net
Updated in 2023 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.