?? ed.1
字號:
The editcommand causes the entire contents of the buffer to be deleted,and then the named file to be read in.`\fB.\fR' is set to the last line of the buffer.The number of characters read is typed.`filename' is remembered for possible use as a default file namein a subsequent.I ror.I wcommand.If `filename' is missing, the remembered name is used..TP 5E filenameThis command is the same as.I e,except that no diagnostic results when no.I whas been given since the last buffer alteration..TP 5f filenameThe filename command prints the currently remembered file name.If `filename' is given,the currently remembered file name is changed to `filename'..TP 5(1,$)\|g/regular expression/command listIn the globalcommand, the first step is to mark every line which matchesthe given regular expression.Then for every such line, thegiven command list is executed with `\fB.\fR' initially set to that line.A single command or the first of multiple commandsappears on the same line with the global command.All lines of a multi-line list except the last line must be ended with `\e'..I A,.I i,and.I ccommands and associated input are permitted;the `\fB.\fR' terminating input mode may be omitted if it would be on thelast line of the command list.The commands.I gand.I vare not permitted in the command list..TP 5.RB (\| .\| )\|i.ns.TP 5<text>.br.ns.TP 5.B ..brThis command inserts the given text before the addressed line.`\fB.\fR' is left at the last line input, or, if there were none,at the line before the addressed line.This command differs from the.I acommand only in the placement of thetext..TP 5.RB (\| .\| ,\ . +1)\|jThis command joins the addressed lines into a single line;intermediate newlines simply disappear.`\fB.\fR' is left at the resulting line..TP 5( \fB. \fR)\|k\fIx\fRThe mark command marks the addressed line withname.I x,which must be a lower-case letter.The address form `\(fm\fIx\fR' then addresses this line..ne 2.5.TP 5.RB (\| .\| ,\ .\| )\|lThe list commandprints the addressed lines in an unambiguous way:non-graphic characters areprinted in two-digit octal,and long lines are folded.The.I lcommand may be placed on the same line after any non-i/ocommand..TP 5.RB (\| .\| ,\ .\| )\|m\fIaThe move command repositions the addressed lines after the lineaddressed by.IR a .The last of the moved lines becomes the current line..TP 5.RB (\| .\| ,\ .\| )\|pThe print command prints the addressed lines.`\fB.\fR'is left at the last line printed.The.I pcommandmaybe placed on the same line after any non-i/o command..TP.RB (\| .\| ,\ .\| )\|PThis command is a synonym for.I p..TP 5qThe quit command causes.I edto exit.No automatic writeof a file is done..TP 5QThis command is the same as.I q,except that no diagnostic results when no.I whas been given since the last buffer alteration..TP 5($)\|r filenameThe read commandreads in the given file after the addressed line.If no file name is given,the remembered file name, if any, is used(see.I eand.I fcommands)\|.The file name is remembered if there was noremembered file name already.Address `0' is legal for.I rand causes thefile to be read at the beginning of the buffer.If the read is successful, the number of charactersread is typed.`\fB.\fR' is left at the last line read in from the file..TP 5(\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/replacement/ or,.br.ns.TP 5(\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/replacement/gThe substitute command searches each addressedline for an occurrence of the specified regular expression.On each line in which a match is found,all matched strings are replaced by the replacement specified,if the global replacement indicator `g' appears after the command.If the global indicator does not appear, only the first occurrenceof the matched string is replaced.It is an error for the substitution to fail on all addressed lines.Any character other than space or new-linemay be used instead of `/' to delimit the regular expressionand the replacement.`\fB.\fR' is left at the last line substituted..IPAn ampersand `&' appearing in the replacementis replaced by the string matching the regular expression.The special meaning of `&' in this context may besuppressed by preceding it by `\e'.The characters.I `\|\en'where.I nis a digit,are replaced by the text matched by the.IR n -thregular subexpressionenclosed between `\e(' and `\e)'.Whennested, parenthesized subexpressionsare present,.I nis determined by counting occurrences of `\e(' starting from the left..IPLines may be split by substituting new-line characters into them.The new-line in thereplacement stringmust be escaped by preceding it by `\e'..TP 5.RB (\| .\| ,\ .\| )\|t\|\fIaThis command acts just like the.I mcommand, except that a copy of the addressed lines is placedafter address.I a(which may be 0).`\fB.\fR' is left on the last line of the copy..TP 5.RB (\| .\| ,\ .\| )\|uThe undo command restores the preceding contentsof the current line, which must be the last linein which a substitution was made..TP 5(1, $)\|v/regular expression/command listThis command is the same as the global command.I gexcept that the command list is executed.I gwith `\fB.\fR' initially set to every line.I exceptthosematching the regular expression..TP 5(1, $)\|w filename.brThe write command writes the addressed lines ontothe given file.If the file does not exist,it is created mode 666 (readable and writable by everyone)\|.The file name is remembered if there was no remembered file name already.If no file name is given,the remembered file name, if any, is used(see.I eand.I fcommands)\|.`\fB.\fR' is unchanged.If the command is successful, the number of characters written isprinted..TP(1,$)W filenameThis command is the same as.I w,except that the addressed lines are appended to the file..TP 5xA key string is demanded from the standard input.Later.I r, eand.I wcommands will encrypt and decrypt the text with this key by the algorithm of .IR crypt (1).An explicitly empty key turns off encryption..TP 5($)\|=The line number of the addressed line is typed.`\fB.\fR' is unchanged by this command..TP 5!<shell command>The remainder of the line after the `!' is sentto.IR sh (1)to be interpreted as a command..RB ` . 'is unchanged..TP 5.RB (\| . +1)\|<newline>An address alone on a line causes the addressed line to be printed.A blank line alone is equivalent to `.+1p'; it is usefulfor stepping through text..PPIf an interrupt signal (ASCII DEL)\| is sent,.I edprints a `?' and returns to its command level..PPSome size limitations:512 characters per line,256 characters per global command list,64 characters per file name,and 128K characters in the temporary file.The limit on the number of lines depends on the amount of core:each line takes 1 word..PPWhen reading a file,.I eddiscards ASCII NUL charactersand all characters after the last newline.It refuses to read files containing non-ASCII characters..SH FILES/tmp/e*.bred.hup: work is saved here if terminal hangs up.SH "SEE ALSO"B. W. Kernighan,.IA Tutorial Introduction to the ED Text Editor.brB. W. Kernighan,.I Advanced editing on UNIX.brsed(1), crypt(1).SH DIAGNOSTICS`?name' for inaccessible file;`?' forerrors in commands;`?TMP' for temporary file overflow..PPTo protect against throwing away valuable work,a.I qor.I ecommand is considered to be in error, unless a.I whas occurred since the last buffer change.A second.I qor.I ewill be obeyed regardless..SH BUGSThe .I lcommand mishandles DEL..brA.I !command cannot be subject to a.I gcommand..brBecause 0 is an illegal address for a.I wcommand, it is not possible tocreate an empty file with.I ed.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -