109 lines · 2.2 KB · Text
RawDownload
.TH GREP 1.SH NAMEgrep \- search a file for a pattern.SH SYNOPSIS.B grep[.B -bchiLlnsv][.B -e].I pattern|.B -f.I patternfile[.I file ...].SH DESCRIPTION.I Grep\^searches the input.I files\^(standard input default)for lines that match the.IR pattern ,a regular expression as defined in.IR regexp (6)with the addition of a newline character as an alternative(substitute for.BR | )with lowest precedence.Normally, each line matching the pattern is `selected',and each selected line is copied to the standard output.The options are.TP.B -cPrint only a count of matching lines..PD 0.TP.B -hDo not print file name tags (headers) with output lines..TP.B -eThe following argument is taken as a.IR pattern .This option makes it easy to specify patterns thatmight confuse argument parsing, such as.BR -n ..TP.B -iIgnore alphabetic case distinctions.  The implementationfolds into lower case all letters in the pattern and input beforeinterpretation.  Matched lines are printed in their original form..TP.B -l(ell) Print the names of files with selected lines; don't print the lines..TP.B -LPrint the names of files with no selected lines;the converse of.BR -l ..TP.B -nMark each printed line with its line number counted in its file..TP.B -sProduce no output, but return status..TP.B -vReverse: print lines that do not match the pattern..TP.B -fThe pattern argument is the name of a file containing regularexpressions one per line..TP.B -bDon't buffer the output: write each output line as soon as it is discovered..PD.PPOutput lines are tagged by file name when there is more than oneinput file.(To force this tagging, include.B /dev/nullas a file name argument.).PPCare should be taken whenusing the shell metacharacters.B $*[^|()=\eand newlinein.IR pattern ;it is safest to enclose theentire expressionin single quotes.BR \&\|' \|.\|.\|.\| ' .An expression starting with '*'will treat the rest of the expressionas literal characters..SH SOURCE.B /sys/src/cmd/grep.SH SEE ALSO.IR ed (1),.IR awk (1),.IR sed (1),.IR sam (1),.IR regexp (6).SH DIAGNOSTICSExit status is null if any lines are selected,or non-null when no lines are selected or an error occurs.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t