Edlin
| Original author(s) | Tim Paterson |
|---|---|
| Developer(s) | Microsoft |
| Operating system | DOS, MS-DOS, OS/2, Microsoft Windows |
| Type | Line editor |
| Website | Edlin |
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] It was originally written for Seattle Computer Products's 86-DOS (QDOS), which Microsoft acquired and sold as MS-DOS.
Contents |
[edit] Usage
|
|
This section contains instructions, advice, or how-to content. The purpose of Wikipedia is to present facts, not to train. Please help improve this article either by rewriting the how-to content or by moving it to Wikiversity or Wikibooks. (October 2011) |
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
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. E.g.: 1,6L to view lines 1 through 6. Each line will be displayed with a line number in front of it.
*1,6L
1: Edlin: The only text editor in early versions of DOS.
2:
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.
*6I
6:*(or something like that)
7:*^C
*7D
*L
1: Edlin: The only text editor in early versions of DOS.
2:
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. E.g.: 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. E.g.: 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 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 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 Edlin per se; long file names were added to MS-DOS and MS-Windows long after Edlin was written.
[edit] FreeDOS Edlin
Gregory Pietsch has written a GPL-licenced clone of Edlin that includes long filename support. The clone is available for download as part of the FreeDOS project, and runs on operating systems such as Linux or Unix as well as MS-DOS. The clone's outputted messages can also be customized for a variety of European languages or Japanese and can be compiled with a variety of C compilers.[2]
[edit] See also
- List of DOS commands
- ed, the Unix equivalent
- 86-DOS
[edit] References
[edit] External links
|
||||||||||||||||||||||||||||||||