⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ed.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 2 页
字号:
.B xis a lowercase letter from the portable character set (a-z).The address form \fB`x\fR will refer tothis line (address form 6 above)..B Currentis unchanged..TP 5.RB (\|.\|,\|.\|)\|lThe list commandprints the addressed lines in an unambiguous way:non-graphic characters areprinted in three-digit octal preceded by a \eunless they are one of the following in which case they will be printedas indicated in the brackets:backslash (`\e\\'),horizontal tab (\et), form feed (\ef).return (\er), vertical tab (\ev), and backspace (\eb).Long lines will be broken based on the type of terminal currently inuse and will likely be ragged at the right side if text and octal aremixed on the same line..B Currentis set to the last line printed.The.I lcommand may be placed on the same line after anycommand except (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR)..TP 5.RB (\|.\|,\|.\|)\|m\fBa\fRThe move command moves the addressed lines in the bufferto after the address.BR a .Line 0 is valid as the address \fBa\fR for this command..B Currentis the location in the.B bufferof the last line moved..TP 5.RB (\|.\|,\|.\|)\|nThe number command prints the addressed lines preceding the text with the line number.The.I ncommandmaybe placed on the same line after any commandexcept (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR)..B Currentis the last line printed..TP 5.RB (\|.\|,\|.\|)\|pThe print command prints the addressed lines.The.I pcommandmaybe placed on the same line after any commandexcept (\fIe\fR, \fIE\fR, \fIf\fR, \fIq\fR, \fIQ\fR, \fIr\fR, \fIw\fR, \fIW\fR, or \fI!\fR)..B Currentis the last line printed..TP.RB (\|.\|,\|.\|)\|PThis command is a synonym for.I pif.I edhas been compiled under the BSD option. If.I edhas been compiled under the POSIX option then the prompt is toggled on or off..B Currentis unchanged when compiled under the POSIX option.The default prompt is "*" if not specified with the \-p option at startup.The prompt is initially off unless the \-p option is specified..TP 5qThe quit command causes.I edto exit. If the entire.B buffer(1,$) has not been written since the last modification.I edwillissue a warning once (`?'); a second issuing of the command will be obeyedregardless..TP 5Q.I Qworks the same as.I qexcept if the buffer has been modified no warning is issued..TP 5($)\|r [filename]The read command reads in the file `filename' after theaddressed line. If no `filename' is specified then the.B "remembered filename"is used. Address 0 is valid for this command.If read is successful then the number of charactersread is printed (unless the -s option is specified).If `filename' is lead by ! then it shall be interpreted as a shellcommand to be executed, from which the standard output will beplaced in the buffer; `filename' will be non-remembered..B Currentis the last line read..TP 5(\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/\fBreplacement\fR/\fBflags\fR.brThe substitute command searches for the regular expression in theaddressed lines.On each line in which a match is found,matched strings are replaced by the \fBreplacement\fR as specifiedby the \fBflags\fR (see below).If no \fBflags\fR appear, by default only the first occurrenceof the matched string in each line is replaced.It is an error if no matches to the RE occur..IPThe delimiters may be any character except <space> or <newline>.The delimiter lead by a \e will escape it to be a literalin the RE or.BR replacement ..IPAn ampersand, `&', appearing in the replacementwill equal the string matching the RE.The `&'s special meaning is supressable by leadingit with a `\e'.When `%' is the only replacement character in.B replacementthe most recentreplacement is used.The `%'s special meaning is supressable by leadingit with a `\e'..IPThe characters `\fB\en\fR' (where \fBn\fR is a digit 1-9) isreplaced by the text matching the RE subexpression.B n(known as backreferencing)..I Smay be used to break lines by including a <newline> in.B replacementpreceeded by a backslash (`\e') to escape it..B Replacementcan continue on the next line and can include another escaped <newline>..IPThe following extention should not be included in portable scripts.When spliting lines using \fIs\fR within the global commands (\fIg\fR,\fIG\fR, \fIv\fR, or \fIV\fR) the <newline> in the replacement stringmust be escaped by preceding it with `\e\e\e' (three adjacent `\e'\|s \-the first `\e' escapes the second `\e' so that it is passed to \fIs\fRto escape the <newline> passed by the global command; the third `\e'is to escape the <newline> so that the global command list continues).[N.B. Other \fIed\fR's do not allow linesplitting within the global commands]..IPThe \fBflags\fR may be any combination of:.RS.IP \fIcount\fRin each addressed line replace the \fIcount\fR\-th matching occurrence..IP gin each addressed line replace all matching occurrences. When \fIcount\fR andg are specified together inclusively replace in each addressed lineall matches from the \fIcount\fR\-th match to the end of line..IP lwrite the line after replacement in the manner specified by the \fIl\fRcommand..IP nwrite the line after replacement in the manner specified by the \fIn\fRcommand..IP pwrite the line after replacement in the manner specified by the \fIp\fRcommand..RE.IPThe following special formshould not be included in portable scripts.This form is maintained for backward compatibility andis extended to dovetail into the above forms of.BR s ..I Sfollowed by.I nodelimitersrepeats the most recent substitute commandon the addressed lines..I Smay be suffixed with the letters.BR r " (use the most recent RE rather than the last RE used with \fIs\fR),".B p(complement the setting of theany print command (l, n, p)suffix from the previous substitution),.B g(complement the setting of the.I gsuffix) or.B N(negate the previous \fIcount\fR flag).These modifying letters may be combined in any order(N.B. multiple use of the modifying letters may cause themto be interpreted as delimiters)..IP.B Currentis set to the last line search (BSD) or where the last replacementoccurred (POSIX)..TP 5.RB (\|.\|,\|.\|)\|t\|\fBa\fRThe transcribe command copies the addressed lines inthe.B bufferto after the address.BR a .Address 0 is valid as the address \fBa\fR for this command..B Currentis the last line transcribed..TP 5.RB (\|.\|,\|.\|)\|uThe undo command nullifies the most recent.B buffermodifying command.Buffer modifying commands undo works on are.IR a ,.IR c ,.IR d ,.IR g ,.IR G ,.IR i ,.IR j ,.IR m ,.IR r ,.IR s ,.IR t ,.IR u ,.IR v ,and.I V.Marks set by the \fIk\fR command will also be restored.All commands (including nested \fIg\fR, \fIG\fR, \fIv\fR, and\fIV\fR commands within the \fIg\fR or \fIv\fR)that undo works on are treated as a single buffer modification.\fBCurrent\fR is set to the line it addressed before the lastbuffer modification..TP 5(1, $)\|v/regular expression/command listThe global non-matching command performs as the.I gcommand does except that the command list is executed for every linethat does not match the RE..TP 5(1, $)\|V/regular expression/The interactive global non-matching command is the same as the.I Gexcept that one command will be accepted as inputwith \fBcurrent\fR initially set to every linethat does not match the RE..TP 5(1, $)\|w [filename].brThe write command writes the addressed lines to the file `filename'.If no `filename' is specified then the.B "remembered filename"is used. If no addresses are specified the whole.B bufferis written.If the command is successful, the number of characters written isprinted (unless the -s option is specified).If `filename' is lead by ! then it shall be interpreted as a shellcommand to be executed which will accept on its standard inputthe section of the buffer specified for writting.\fBCurrent\fR is unchanged..TP(1, $)\|W [filename].I Wworks as the.I wcommand does except the addressed contents of the.B bufferare appended to `filename' (or the.B "remembered filename"if `filename' is not specified). If `filename' is lead by ! then.I Wwill act exactly as the.I wcommand.\fBCurrent\fR is unchanged..TP 5(1, $)\|wq [filename].I wqworks as the.I wcommand does with the addition that.I edexits immediately after the write is complete.\fBCurrent\fR is unchanged..TP 5(1,$)\|Wq [filename].I Wqworks as the.I Wcommand does with the addition that.I edexits immediately after the appended write is complete.\fBCurrent\fR is unchanged..TP 5.RB (\|.\|+1)\|z\ \ \ \ or,.br.TP 5.RB (\|.\|+1)\|z\fBn\fRScroll through the.BR buffer .Starting from the addressed line (or.BR current +1)print the next 22 (by default or.BR n )lines. The.B nis a sticky value; it becomes the default number of lines printedfor successive scrolls..B Currentis the last line printed..TP 5($)\|=Print the number of lines in the.BR buffer .If an address is provided (in the forms 1-8 above) then the line numberfor that line will be printed.\fBCurrent\fR is unchanged..TP 5!<shell command>The command after the.I !is executed by \fIsh(1)\fR and the results are printed. A `!' isprinted in the first column when execution has completed (unless the -soption has been specified).A `!' immediately after \fI!\fR repeats the last shell command.An unescaped `%' represents the remembered filename.Commands to \fIsh(1)\fR can have several lines by escaping the <newline>with a `\e' immediately before it. The line continuation characterfor \fIsh(1)\fR, `\e', can be included on a line provided that itis escaped by a `\e' immediately before so that \fIed\fR passes itliterally to \fIsh(1)\fR: `\e\e'. It is implicit that for the commandline that the \fIsh(1)\fR line continuation character is on that the<newline> will be escaped (e.g. `\e\e\e<newline>').This behavior can be used within global command lists. However, anadditional `\e' must be added so that the \fI!\fR command continuor ispassed to \fI!\fR - it must occur immediately before the globalcommand's continuor. Therefore,the \fI!\fR command continuation sequence in a global command listwill appear as `\e\e\e' (explanation as with \fIsfR). The line continuationcharacter for \fIsh(1)\fR needs no additional escaping (since it itnot dependant on <newline> being adjacent) - hence, thesequence in a global command list with a line continuation will appearas `\e\e\e\e\e<newline>'.\fBCurrent\fR is unchanged..TP 5/regular expression/\|\|\|\|\|or,.br.TP 5?regular expression?.brThe search command searches forward, `/', (or backward, `?') through the.B bufferattempting to finda line that matches the RE. The search will wrap to the top  (or bottom)of the.B bufferif necessary. Search returns the line number that the match occurs on -combined with the null command (see below) this causes the line to be printed..B Currentis the matching line..TP 5.RB (\|.+1,\|.+1)\|<newline>.brThe null command is equivalent to asking for the line.BR current +1to be printed according to the.I pcommand. This is a useful command to quickly print the next couple oflines. If more than a couple of lines are needed the.I zcommand (see above) is much better to use. \fBCurrent\fR is the last line printed..SH OTHER.PPIf an interrupt signal (SIGINT)\| is sent,.I edprints `?'and returns to command mode..PPBSD command pairs (pp, ll, etc.) are permitted. Additionally any singleprint command may follow any of the non-I/O commands (I/O commands:e, E, f, r, w, W, wq, and !). This will cause the current line to beprinted in the specified manner after the command has completed..PPPrevious limitations on the number of characters per line and per commandlist have been lifted; there is now no maximum.File name and path length is restricted to the maximum length thatthe current file system supports.The.I undocommand now restores marks to affected lines.The temporary buffer method will vary dependent on the method selected atcompile. Two methods work with a temporary file (stdio and db), while thethird uses memory.The limit on the number of lines depends on the amount of memory..SH FILES/tmp/_bsd44_ed*.br.XPed.hup: the buffer is written to this file in the currentdirectory if possible and in the HOME directory is not(if the signal SIGHUP (hangup) is received)..SH "SEE ALSO"B. W. Kernighan,.IA Tutorial Introduction to the ED Text Editor.brB. W. Kernighan,.IAdvanced editing on UNIX.brex(1), learn(1), regex(3), regex(7), sed(1), vi(1), POSIX 1003.2 (4.20).SH "AUTHOR"Rodney Ruddock.SH DIAGNOSTICS`?name' for a file that is either inaccessible, does not exist, or isa directory. `?'for all other errors unless the help messages have been toggled on (withthe H command) in which case a descriptive message will be printed..PPEOF is treated as a newline during input so that characters after the last <newline>are included into the \fBbuffer\fR; the message "<newline> added atend of line" is printed..PP.I EdReturns an exit status of 0 on successful completion. A value >0 is returnedto indicate an \fIed\fR error: 1 for a command line error, 2 for HUPsignal received, 4 for an \fIed\fR command error; these error valueswill be or'd together when appropriate..SH NOTES.PPRegular expressions are now described on regex(7)..I Edfollows basic regular expressions (BRE's) as described on regex(7).BRE's, for the most part, are the same as previous.I edRE's. The changes to the RE's are extensions for internationalizationunder POSIX 1003.2. Old scripts with RE's should work withoutmodification..PPRegular expression logic is very tight. If you believe a command with aregular expression in it has performed erroneously then a close readingof regex(7) is likely required..PPAddress `0' is legal only for those commands which explicitly state thatit may be used; its use is illegal for all other commands..PPThe special form of substitute has been maintained for backwardcompatability and should not be used in scripts if they are toportable..PPHelp messages may appear ambiguous to beginners - particularly when BRE'sform part of the command..PPFor backward compatability, when more addresses are providedthan required by a command the one or two addresses closest to thecommand are used (depending on how may addresses the command accepts).Portable scripts should not rely on this feature..PPFor backward compatibility the option `-' isequivalent to the `-s' option at the startup of.IR ed .

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -