[this text stolen from "help ed" (as a wizard) on EotL. I don't know its source, and couldn't find it on google... I imagine it's copyrighted by someone, so I may take it down at some point, but it seems like something useful to have on-line somewhere, so...] WMut's guide to LPMud Ed -------------------------- ed [] no filename ==> last file in your /usr with errors. Ed has two modes, command mode and insert mode. The prompt for command mode is ':', the prompt for insert mode is '*'. Command Mode: ------------ This is the mode that ed starts in. Commands given to ed have the following syntax: , or: If no lines are specified, the default is 'the current line'. The current line is the most recent line that has been referred to. , or specify the range of lines over which the command is to be run. The following are valid for specifying a line: . means the current line $ means the last line of the buffer 'a means the line which is mark a. You can 'mark' lines, using the 'k' command. See below. .+5 means 5 lines ahead of the current one. This will error if there arent 5 lines after the current one. .-5 means 5 lines before the current one. These can be combined, for example 'c-5,$ means 'from 5 lines before mark c to the end of the buffer' Commands for inserting text: i insert text before the line. a append text after the line. c change text (delete the specified line(s), and replace with whatever is typed. These all put you in 'insert mode'. You can exit insert mode by typing a '.' on a line by itself. Commands for displaying text: p print the specified lines. P same as p. l list lines (same as p, but control characters are shown.) z. show from 10 lines before to ten lines after the current one. z- show the 20 lines before the current one. z+ show the 20 lines after the current one. z same as z+ show next line. Commands for moving text: j join next line onto the end of current one. m move specified line(s) to before t copy specified line(s) to after eg 2,6m10 would move lines 2 to 6 to immediately before line 10. 2,6t10 would copy lines 2 to 6 to immediately after line 10. Commands for file handling: e edit filename. E edit filename, dont worry if the current file hasn't been saved. r read another file into the end of the current bufffer. w save the buffer as x save the buffer, quit. Commands for searching and replacing: s/lhs/rhs search for first occurance of 'lhs' on each line, replace with 'rhs' s/lhs/rhs/g replace all occurances of 'lhs' with 'rhs' g/lhs/ find all lines containing 'lhs', and run on them. v/lhs/ find all lines NOT containing 'lhs' and run on them. /lhs find next line containing 'lhs' ?lhs find previous line containing 'lhs' / or ? will repeat the last search. 'lhs' may be a regular expression (regexp), see below, 'Regular Expressions'. Miscellaneous commands: = display current line number f show file name k set mark , may be from a to z. n toggle line numbers on/off Regular expressions: There are special characters that can be used in the pattern: . Match any character. x* Match any numbers of x (0 or more). [abc] Match 'a', 'b' or 'c'. [0-9] Match any digit 0 - 9. [a-z] Match any lowercase letter. \x Match 'x' where 'x' can be any character except '(' and ')'. Example: s/ab.d/ABCD/ Substitute any string 'abXd' against 'ABCD' where X can be any character.