Page MenuHomeFreeBSD

D27264.1794988678.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D27264.1794988678.diff

Index: usr.bin/grep/grep.1
===================================================================
--- usr.bin/grep/grep.1
+++ usr.bin/grep/grep.1
@@ -456,13 +456,24 @@
.Sh EXAMPLES
.Bl -dash
.It
-To find all occurrences of the word
+Find all occurrences of the text
.Sq patricia
in a file:
.Pp
.Dl $ grep 'patricia' myfile
.It
-To find all occurrences of the pattern
+Same as above but looking only for complete words:
+.Pp
+.Dl $ grep -w 'patricia' myfile
+.It
+Count occurrences of the text
+.Sq foo
+:
+.Bd -literal -offset indent
+$ grep -c foo myfile
+.Ed
+.It
+Find all occurrences of the pattern
.Ql .Pp
at the beginning of a line:
.Pp
@@ -480,20 +491,56 @@
.Ql \&. ,
which would otherwise match any character.
.It
-To find all lines in a file which do not contain the words
+Find all lines in a file which do not contain the words
.Sq foo
or
.Sq bar :
.Pp
.Dl $ grep -v -e 'foo' -e 'bar' myfile
.It
-A simple example of an extended regular expression:
+Peruse the file
+.Sq calendar
+looking for either 19, 20, or 25 using extended regular expressions:
.Pp
.Dl $ egrep '19|20|25' calendar
+.It
+Show matching lines and the name of the
+.Sq *.h
+files which contain the text
+.Sq FIXME
+ignoring case.
+Do the search recursively from the
+.Pa /usr/src/sys/arm
+directory
.Pp
-Peruses the file
-.Sq calendar
-looking for either 19, 20, or 25.
+.Dl $ grep -H -i -R FIXME --include=*.h /usr/src/sys/arm/
+.It
+Same as above but showing only the name of the matching file:
+.Pp
+.Dl $ grep -l -i -R FIXME --include=*.h /usr/src/sys/arm/
+.It
+Show lines containing the text
+.Sq foo .
+The matching part of the output is colored and every line is prefixed with
+the line number and the offset in the file for those lines that matched.
+.Pp
+.Dl $ grep -b --colour -n foo myfile
+.It
+Show lines that match the extended regular expression patterns read from the
+standard input:
+.Pp
+.Dl $ echo -e 'Free\enBSD\enAll.*reserved' | grep -E -f - myfile
+.It
+Show lines from the output of the
+.Xr pciconf 8
+command matching the specified extended regular expression along with
+three lines of leading context and one line of trailing context:
+.Pp
+.Dl $ pciconf -lv | grep -B3 -A1 -E 'class.*=.*storage'
+.It
+Suppress any output and use the exit status to show an appropriate message:
+.Pp
+.Dl $ grep -q foo myfile && echo File matches
.El
.Sh SEE ALSO
.Xr ed 1 ,

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 18, 7:57 AM (15 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41819404
Default Alt Text
D27264.1794988678.diff (2 KB)

Event Timeline