Make your own free website on Tripod.com

Friendly Edlin Tutorial

It best to read about the wrapper first, since running edlin directly isn't exactly enlightening.

Using Edlin

Run e newfile.txt and you will see the command mode:

new file
*

For an old file, you'll see:

end of file
*

To begin, enter 1i or i. i means insert a line before line 1 and enter the edit mode, like this:

new file
*1i
	1:*

The astrix marks the current line- most commands are executed with respect to the current line unless you say not to. A line can be about three lines long. Hit return to get the next line. Hit control-C to go back to the command mode.

We now have:

new file
*1i
	1: @echo off
	2: cls
	3: type edlin.txt | more
	4: edlin %1
	5: cls
	6:*^c
*e

Now we can save the file with e, or quit without saving with q. The process is done.

Features

Load up the file again, and enter l to list the program. Lets say we want to avoid typing .txt and always use .txt as a default. We need to change lines 3. Enter 3. Then hit the right arrow & the contents of the line will appear character by character, until you reach the offending byte. If the remaining bytes were okay, just hit <F3> to fill in the rest of the line.

new file
*l
	1: @echo off
	2: cls
	3: type edlin.txt | more
	4: edlin %1
	5: cls
*4
	4:*edlin %1.txt
*

Entering with i and n

10i inserts a line before 10 and puts you into the edit mode. Hitting return inserts yet another line. Control-z+enter inserts an end of file character and returns you to the command mode. Control-c puts you in the command mode immediately without adding any characters.

10 puts you in the edit mode for line 10 only. Hitting return puts you back into the command mode. n is a line number, don't enter the letter n.

You start out in the type over mode. Hit the insert key to go to the insert mode. Hitting F3 now will append the entire original line.

Viewing Files with p and l

l will list 11 lines immediately before and 11 lines after the current line for a total of 23 lines. 2,3l will list the lines from 2 to 3.

p is a lot like l, except p moves the current line forward to the last line displayed. Repeated l shows the same lines, repeated p moves through the document

If you fire up ANSI.SYS and run MODE CON LINES, you can display more than 23 lines at a time.

Edlin doesn't display long lines beautifully. Edlin prefers lines to be kept to 70 characters or less to avoid, 'Continue? (y/n)' prompt half way through a page of text.

Saving and Quiting with e and q

e saves and quits. Edlin automatically makes a backup file, with the extension .bak. The wrapper has a option for killing .bak files.

q asks you if you want to abort, then quits.

Cut and Paste with c, d and m

5,20c copies line 5 and puts it before line 20.

5,10,20c copies all the lines from 5 to 10 and puts them before line 20.

5,10,100,20c copies lines 5 to 10 one hundred times and puts them before line 20.

5,10d deletes lines 5 to 10.

5,10,20m moves lines 5 to 10 and puts them before line 20.

Search and Replace with s and r

5,10swaldo searches for waldo between lines 5 and 10.

?swaldo searches for waldo, then asks if you have found enough, or if you want more.

5,10ryour's<f;6>mine replaces all occurrences of your's with mine from lines 5 to 10, without asking. The <f6&g means hit the F-key 6. It shows up on the screen as ^Z.

5,10?ra^Zan changes a to an, but ask your permission first.

Headers, footers and macros with t

Create a file with your address, save it as address.txt. In a new file, say letter.txt, enter the command 1t:address.txt. It will insert address.txt at line 1. Similarly you can use this for footers, macros, and merging files.

Memory Management using a and w

Edlin can deal with 65,529 lines. It only loads a few lines in initially- at most 75% of memory, so you need to use 100w to save the first 100 lines, 100a to load 100 more lines. After you write, and load you will have to quit to get back the first part.

Tricks and Rules of Thumb

Execute multiple commands using ; between each command.

Display special characters by typing control-v, followed by a letter a to z.

The current line is the last line edited, or manipulated.

Commands follow the pattern [start],[finish],[destination][letter]

Leaving off a line number parameter will be interpreted as the current line.

Period means current line. 5,.,20c will copy lines 5 to current and insert before line 20.

+ and - mean lines after and before current. 5,+3,20 will copy lines 5 to 3 after the current and insert before line 20.

# means line after last, or end of file.

Hit control-p to print. Never hit control-p unless you can print to the PRN port.

Bugs

A line with exactly 69 characters will spit out a prompt Continue?, before it word wraps. Its a bug in versions 4 & 5. So for happy scrolling, reformat all your documents to 68 columns.

Special Characters

Hit control-v followed by control character to insert a special character. Here is the table of control characters. Next time you list, ^vd will show up as ^d. Control-i (tab), control-j (line feed), control-m (carriage return) are displayed literally.

Making music with Control-G

Control-G doesn't print to the screen, instead it beeps. By varying the number of blank lines between beeps, you can write a tune.

Return to Front Page
Contact The Friendly Edlin Page

Webspace Worldwide Ltd Webspace hosted by Webspace Worldwide Limited..