related topics
{system, computer, user}
{math, number, function}
{language, word, form}
{work, book, publish}
{style, bgcolor, rowspan}

Edlin is a line editor included with MS-DOS and later Microsoft operating systems. It provides rudimentary capabilities for editing plain text files through a command-driven interface. Line numbers are specified using numerals, and operations are specified using single-character alphabetic commands (e.g. "5d" instructs the program to delete the 5th line of the file).

It was the only text editor provided with MS-DOS before version 5.0 of that system, when it was superseded by the full screen MS-DOS Editor. It was removed in version 6. However, Edlin is included in 32-bit versions of Windows NT, since NTVDM's DOS support is based on MS-DOS version 5.0. Unlike most other external DOS commands, it has not been transformed into a native, Win32 program. Its persistence can probably be explained by the fact that it can be invoked to automatically perform small modifications on text files, by piping a script of commands to it through standard input.

Edlin was created by Tim Paterson in two weeks in 1980, and was expected to have a six-month shelf life.[1] Edlin was originally written for Seattle Computer Products's 86-DOS (QDOS), which Microsoft acquired and sold as MS-DOS.

Although seldom used in modern times, Edlin may sometimes be used as an Edlin-script interpreter, in environments where no other editors exist. Scripts may look like Edlin command sequences and they may be run as:

edlin < script


[edit] Usage

There are only a handful of commands available. The short list can be found by entering a ? at the edlin prompt, which yields the following:

Edit line                   line#
Append                      [#lines]A
Copy                        [startline],[endline],toline[,times]C
Delete                      [startline][,endline]D
End (save file)             E
Insert                      [line]I
List                        [startline][,endline]L
Move                        [startline],[endline],tolineM
Page                        [startline][,endline]P
Quit (throw away changes)   Q
Replace                     [startline][,endline][?]R[oldtext][CTRL+Znewtext]
Search                      [startline][,endline][?]Stext
Transfer                    [toline]T[drive:][path]filename
Write                       [#lines]W

When a file is open, type L to list the contents. Eg: 1,6L to view lines 1 through 6. Each line will be displayed with a line number in front of it.

       1: Edlin: The only text editor in early versions of DOS.
       3: Back in the day, I remember seeing web pages
       4: branded with a logo at the bottom:
       5: "This page created in edlin."
       6: The things that some people put themselves through. ;-)

The currently selected line will have a *. To replace the contents of any line, enter the line number. To cancel any changes while editing a line press Ctrl-C. The * marker will remain on that line.

Entering I (optionally preceded with a line number) will insert one or more lines before the * line or the line given. When finished entering lines, Ctrl-C will return to the edlin command prompt.

       6:*(or something like that)
       1: Edlin: The only text editor in early versions of DOS.
       3: Back in the day, I remember seeing web pages
       4: branded with a logo at the bottom:
       5: "This page created in edlin."
       6: (or something like that)

D will delete the specified line, again optionally starting with the number of a line, or a range of lines. Eg: 2,4d will delete lines 2 through 4. In the above example, line 7 was deleted. This is probably a poor example, as the line could have simply been replaced by entering a 6, then replacing the old line 6.

R is used to replace all occurrences of a piece of text in a given range of lines, for example, to replace a spelling error. Including the ? will prompt you for each change. Eg: To replace 'prit' with 'print' and to prompt for each change, enter ?rprit^Zprint (the ^Z represents pressing CTRL-Z). It is case-sensitive.

S will search for given text. It is used in the same way as replace, but without the replacement text. A search for 'apple' in the first 20 lines of a file, would be typed 1,20?sapple (no space, unless that is part of the search) and press enter. For each match, it will ask if it the correct one, and accept n or y (or Enter).

P displays listing of range of lines. If no range is specified. P will display the complete file from the * to the end. This is different from L in that P changes the current line to be the last line in the range.

T is used to transfer another file into the one being edited, with this syntax: [line to insert at]t[full path to file].

To save the file, type W (write). To save and quit, type E (end). To exit without saving, type Q (quit).

[edit] Long filenames support

Use of Microsoft's Edlin in today's environments is somewhat limited as it does not support long filenames. For example, attempting to edit an existing file named "longfilename.txt" results in Microsoft's Edlin creating a new file named "longfile.txt". This is related to limitations of the MS-DOS operating system prior to version 7.0 and not Microsoft's Edlin per se; long file names were added to MS-DOS and MS-Windows long after Microsoft's Edlin was written.

Full article ▸

related documents
Applesoft BASIC
Fiber distributed data interface
Intel 80186
Fluent, Inc.
IP over Avian Carriers
Microphone array
MOS Technology 6510
AMOS (programming language)
Interior Gateway Routing Protocol
Display PostScript
Pine (e-mail client)
Automatic number announcement circuit
Carrier sense multiple access with collision detection
Television receive-only
Evolution (software)
Intel 80486DX2
Common Gateway Interface
Personal Area Network
Inter-process communication
IBM 8514
Vertical interval timecode
IBM System p