Name
grep — Searches for matching patterns
Synopsis
grep [-c -i -n -v]searchPattern
[objectName
]
Description
grep
searches the named shell object for
lines containing a match to the given search pattern. Matching lines
are written to standard output. Regular expressions are not currently
supported.
If no object is specified on the
command line, grep will read from stdin
. If
stdin
is the console, you may type in lines of
text. Enter a “.” all by itself at
the beginning of a line to finish.
Options
-
-c
Just prints count of matching lines; with
-v
, counts non-matching lines-
-i
Ignores case when comparing text with search pattern
-
-n
Shows line numbers of matches found
-
-v
Shows non-matching lines instead of matching lines
Example
JXTA>grep -i -n dog GroceryList
3:Hot dogs 7:Dog food JXTA>cat GroceryList | grep -c dog
2
Get JXTA in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.