Cisco Cisco Packet Data Gateway (PDG)
grep for Regular Expressions
Use the | grep keyword to filter through a command's output for certain expressions or patterns. Only those
portions of the output that contain or exclude the pattern are displayed. The | grep has the following syntax:
portions of the output that contain or exclude the pattern are displayed. The | grep has the following syntax:
| grep [ -E | -i | -n |-v | --extended-regexp
| --
ignore-case | --invert-match | --line-number ] expression
Table 4: grep Options
Description
Alternative Keyword
Match using extended regular expressions (EREs). Treat each pattern specified
as an ERE ("IEEE Std 1003.1-2001, Section 9.4, Extended Regular
Expressions"). If any entire ERE pattern matches some part of an input line
excluding the terminating <newline>, the line shall be matched. A null ERE
shall match every line.
as an ERE ("IEEE Std 1003.1-2001, Section 9.4, Extended Regular
Expressions"). If any entire ERE pattern matches some part of an input line
excluding the terminating <newline>, the line shall be matched. A null ERE
shall match every line.
-E
Perform pattern matching in searches without regard to case. Lower case
matches the same as upper case.
matches the same as upper case.
-i
Precede each output line by its relative line number in the file, each file starting
at line 1. The line number counter is reset for each file processed.
at line 1. The line number counter is reset for each file processed.
-n
Select lines not matching any of the specified patterns. If the -v option is not
specified, selected lines shall be those that match any of the specified patterns.
specified, selected lines shall be those that match any of the specified patterns.
-v
The long form of the -E option.
--extended-regexp
The long form of the -i option.
--ignore-case
The long form of the -v option.
--invert-match
Specifies the character pattern to find in the command's output as an
alphanumeric string of 1 to 256 characters.
alphanumeric string of 1 to 256 characters.
expression
A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously
to arithmetic expressions, by using various operators to combine smaller expressions. For additional information,
refer to ISO/IEC/IEEE 9945:2009 Information technology – Portable Operating System Interface (POSIX
to arithmetic expressions, by using various operators to combine smaller expressions. For additional information,
refer to ISO/IEC/IEEE 9945:2009 Information technology – Portable Operating System Interface (POSIX
®
)
Base Specifications, Issue 7.
Command Line Interface Reference, Modes A - B, StarOS Release 19
14
Command Line Interface Overview
Regulating the Command Output