User guide
grep
+ Repeated matching.
When placed after a pattern, the plus sign indicates that the pattern
should match one or more times. For example, [0-9]+ matches any
sequence of one or more digits.
? Optional matching.
When placed after a pattern, the question mark indicates that the
pattern can match zero or one times. For example, [a-z][0-9]? matches a
lowercase letter alone or followed by a single digit.
\x’ Prevents the character (denoted by x) following the backslash from
having special meaning.
file
...
Specifies the files to be searched. If you do not specify a file, the command
seaches STDIN.
Options
-c
Prints only the number of lines that matched.
-i
Ignores case in the search. By default, the grep command is case sensitive.
-n
Prints the line numbers of the matching lines.
-v
Prints all lines that do not contain the expression.
-f
file
Take the regular expression from a file instead of the command line.
Examples
1.
>>> ps | grep ewa0
0000001f 0019e220 3 2 ffffffff 0 mopcn_ewa0 waiting on mop_ewa0_cnw
00000019 0018e220 2 1 ffffffff 0 mopid_ewa0 waiting on tqe
00000018 0018f900 3 3 ffffffff 0 mopdl_ewa0 waiting on mop_ewa0_dlw
00000015 0019c320 5 0 ffffffff 0 tx_ewa0 waiting on ewa0_isr_tx
00000013 001a2ce0 5 2 ffffffff 0 rx_ewa0 waiting on ewa0_isr_rx
The output of the ps command (STDIN) is searched for lines containing
EWA0.
Console Commands 13–53