?? ed.1
字號:
.TH ED 1 .if t .ds q \(aa.if n .ds q '.SH NAMEed \- text editor.SH SYNOPSIS.B ed[.B \-] [.B \-x] [ name ].SH DESCRIPTION.I Edis the standard text editor..PPIf a.I nameargument is given,.I edsimulates an.I ecommand (see below)\| on the named file; that is to say,the file is read into.I ed'sbuffer so that it can be edited.If .B \-xis present, an.I xcommand is simulated first to handle an encrypted file.The optional.B \-suppresses the printingof character counts by.I e,.I r,and.I wcommands..PP.I Edoperates on a copy of any file it is editing; changes madein the copy have no effect on the file until a.IR w ""(write)\|command is given.The copy of the text being edited residesin a temporary file called the .IR buffer ..PPCommands to.I edhave a simple and regular structure: zero ormore.I addressesfollowed by a single character.I command,possiblyfollowed by parameters to the command.These addresses specify one or more lines in the buffer.Missing addresses are supplied by default..PPIn general, only one command may appear on a line.Certain commands allow the addition of text to the buffer.While.I edis accepting text, it is saidto be in.I "input mode."In this mode, no commands are recognized;all input is merely collected.Input mode is left by typing a period `\fB.\fR' alone at thebeginning of a line..PP.I Edsupports a limited form of.I "regular expression"notation.A regular expression specifiesa set of strings of characters.A member of this set of strings is said to be.I matchedby the regular expression.In the following specification for regular expressionsthe word `character' means any character but newline..IP 1.Any character except a special charactermatches itself.Special characters arethe regular expression delimiter plus.RB \e\|[\| .and sometimes ^\|*\|$..IP 2.A.B .matches any character..IP 3.A \e followed by any character except a digit or (\|) matches that character..IP 4.A nonempty string.I sbracketed.RI [ \|s\| ](or.RI [^ s\| ])matches any character in (or not in).I s.In .I s,\e has no special meaning, and ] may only appear asthe first letter.A substring .I a\-b,with.I aand.I bin ascending ASCII order, stands for the inclusiverange of ASCII characters..IP 5.A regular expression of form 1-4 followed by * matches a sequence of0 or more matches of the regular expression..IP 6.A regular expression,.I x,of form 1-8, bracketed.RI \e( \|x\| \e)matches what.I xmatches..IP 7.A \e followed by a digit .I nmatches a copy of the string that thebracketed regular expression beginning with the.IR n th\e( matched..IP 8.A regular expression of form 1-8,.I x,followed by a regular expression of form 1-7,.I ymatches a match for.I xfollowed by a match for.I y,with the.I xmatch being as long as possible while still permitting a.I ymatch..IP 9.A regular expression of form 1-8 preceded by ^(or followed by $), is constrained to matches thatbegin at the left (or end at the right) end of a line..IP 10.A regular expression of form 1-9 picks out thelongest among the leftmost matches in a line..IP 11.An empty regular expression stands for a copy of thelast regular expression encountered..PPRegular expressions are used in addresses to specifylines and in one command(see.I sbelow)\|to specify a portion of a line which is to be replaced.If it is desired to use one ofthe regular expression metacharacters as an ordinarycharacter, that character may be preceded by `\e'.This also applies to the character bounding the regularexpression (often `/')\| and to `\e' itself..PPTo understand addressing in.I edit is necessary to know that at any time there is a.I "current line."Generally speaking, the current line isthe last line affected by a command; however,the exact effect on the current lineis discussed under the description ofthe command.Addresses are constructed as follows..TP1.The character `\fB.\fR' addresses the current line..TP2.The character `$' addresses the last line of the buffer..TP3.A decimal number.I naddresses the.IR n -thline of the buffer..TP4.`\(fm\fIx\fR' addresses the line marked with the name.IR x ,which must be a lower-case letter.Lines are marked with the.I kcommand described below..TP5.A regular expression enclosed in slashes `/' addressesthe line found by searching forward from the current lineand stopping at the first line containing astring that matches the regular expression.If necessary the search wraps around to the beginning of thebuffer..TP6.A regular expression enclosed in queries `?' addressesthe line found by searching backward from the current lineand stopping at the first line containinga string that matches the regular expression.If necessarythe search wraps around to the end of the buffer..TP7.An address followed by a plus sign `+'or a minus sign `\-' followed by a decimal number specifies that address plus(resp. minus)\| the indicated number of lines.The plus sign may be omitted..TP8.If an address begins with `+' or `\-'the addition or subtraction is taken with respect to the current line;e.g. `\-5' is understood to mean `\fB.\fR\-5'..TP9.If an address ends with `+' or `\-',then 1 is added (resp. subtracted).As a consequence of this rule and rule 8,the address `\-' refers to the line before the current line.Moreover,trailing`+' and `\-' charactershave cumulative effect, so `\-\-' refers to the currentline less 2..TP10.To maintain compatibility with earlier versions of the editor,the character `^' in addresses is equivalent to `\-'..PPCommands may require zero, one, or two addresses.Commands which require no addresses regard the presenceof an address as an error.Commands which accept one or two addressesassume default addresses when insufficient are given.If more addresses are given than such a command requires,the last one or two (depending on what is accepted)\| are used..PPAddresses are separated from each other typically by a comma`\fB,\fR'.They may also be separated by a semicolon`\fB;\fR'.In this case the current line `\fB.\fR' is set tothe previous address before the next address is interpreted.This feature can be used to determine the startingline for forward and backward searches (`/', `?')\|.The second address of any two-address sequencemust correspond to a line following the line corresponding to the first address..PPIn the following list of.I edcommands, the default addressesare shown in parentheses.The parentheses are not part ofthe address, but are used to show that the given addresses arethe default..PPAs mentioned, it is generally illegal for more than onecommand to appear on a line.However, most commands may be suffixed by `p'or by `l', in which casethe current line is eitherprinted or listed respectivelyin the way discussed below..TP 5.RB (\| .\| )\|a.br.ns.TP 5<text>.br.ns.TP 5.B ..brThe append command reads the given textand appends it after the addressed line.`\fB.\fR' is lefton the last line input, if therewere any, otherwise at the addressed line.Address `0' is legal for this command; text is placedat the beginning of the buffer..TP 5.RB (\| .\| ,\ .\| )\|c.br.ns.TP 5<text>.br.ns.TP 5.B ..brThe changecommand deletes the addressed lines, then accepts inputtext which replaces these lines.`\fB.\fR' is left at the last line input; if there were none,it is left at the line preceding the deleted lines..TP 5.RB (\| .\| ,\ .\| )\|dThe delete command deletes the addressed lines from the buffer.The line originally after the last line deleted becomes the current line;if the lines deleted were originally at the end,the new last line becomes the current line..TP 5e filename
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -