?? grep.1
字號:
.\" SCCSID: @(#)grep.1 8.1 9/11/90.TH grep 1.SH Namegrep, egrep, fgrep \- search file for regular expression.SH Syntax.B grep[\|\fIoption...\fR\|] \fIexpression\fR [\|\fIfile...\fR\|] .PP.B egrep [\|\fIoption...\fR\|] [\|\fIexpression\fR\|][\|\fIfile...\fR\|] .PP.B fgrep[\|\fIoption...\fR\|] [\|\fIstrings\fR\|][\|\fIfile\fR\|].SH Description.NXR "grep command".NXR "egrep command".NXR "fgrep command".NXR "file" "finding pattern".NXA "grep command" "sed stream editor"Commands of the.PN grepfamily search the input.I files(standard input default) for lines matching a pattern.Normally, each line found is copied to the standard output..PPThe.PN grepcommand patterns are limited regular expressions in the style of.MS ex 1 ,which uses a compact nondeterministic algorithm.The.PN egrepcommand patterns are full regular expressions. The.PN egrepcommand uses a fast deterministicalgorithm that sometimes needs exponential space.The.PN fgrepcommandpatterns are fixed strings. The.PN fgrepcommand is fast and compact..PPIn all cases the file name is shownif there is more than one input file.Take care when usingthe characters $ * [ ^ | ( ) and \\ in the.I expressionbecause they are also meaningful to the Shell.It is safest to enclose the entire.I expressionargument in single quotes \' \'..PPThe.PN fgrepcommandsearches for lines that contain one of the (new line-separated).I strings..PPThe.PN egrepcommandaccepts extended regular expressions.In the following description `character' excludes new line:.IPA \e followed by a single characterother than new line matches that character..IPThe character ^ matches the beginning of a line..IPThe character $ matches the end of a line..IPA .B .(dot) matches any character..IPA single character not otherwise endowed with specialmeaning matches that character..IPA string enclosed in brackets [\|] matchesany single character from the string.Ranges of ASCII character codes may be abbreviated as in `a\-z0\-9'.A ]may occur only as the first character of the string.A literal \- must be placed where it can'tbe mistaken as a range indicator..IPA regular expression followed by an * (asterisk) matches a sequence of 0or more matches of the regular expression.A regular expression followed by a + (plus)matches a sequence of 1 or morematches of the regular expression.A regular expression followedby a ? (question mark) matches a sequence of0 or 1 matches of the regular expression..IPTwo regular expressions concatenated match a match of the first followedby a match of the second..IPTwo regular expressions separated by | or new linematch either a match for the first or a match for the second..IPA regular expression enclosed in parenthesesmatches a match for the regular expression..PPThe order of precedence of operators at the same parenthesis levelis the following: [\|], then *+?, then concatenation, then | and new line..SH Options.NXR "grep command" "options".IP \fB\-b\fR 12Precedes each output line with its block number.This is sometimes useful in locating disk block numbers by context..IP \fB\-c\fR Produces count of matching lines only..IP "\fB\-\|e\fI expression\fR" Uses next argument as expression that begins with a minus (\-). .IP "\fB\-\|f\fI file\fR" Takes regular expression(\fBegrep\fR) or string list (\fBfgrep\fR) from .I file..IP \fB\-i\fR Considers upper and lowercase letter identical in making comparisons .PN (grep and.PN fgreponly)..IP \fB\-l\fR Lists files with matching lines only once, separated by a new line..IP \fB\-n\fR Precedes each matching line with its line number..IP \fB\-s\fR Silent mode and nothing is printed (except error messages).This is useful for checking the error status (see DIAGNOSTICS)..IP \fB\-v\fR Displays all lines that do not match specified expression..IP \fB\-w\fR Searches for an expression as for a word(as if surrounded by `\e<' and `\e>').For further information, see .MS ex 1 ,.PN greponly..IP \fB\-x\fR Prints exact lines matched in their entirety .PN (fgreponly)..SH Restrictions.NXR "grep command" "restricted"Lines are limited to 256 characters; longer lines are truncated..SH Diagnostics.NXR "grep command" "diagnostics"Exit status is 0 if any matches are found,1 if none, 2 for syntax errors or inaccessible files..SH See Alsoex(1), sed(1), sh(1)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -