Cisco Cisco Email Security Appliance C650 Referências técnicas
G R E P
C H A P T E R 3 : T H E C O M M A N D S : R E F E R E N C E E X A M P L E S
227
Note — You must enter either
-e regex
or
regex
to return results.
Use the following options when you run the
grep
command:
Example of grep
The following example shows a search for the text string ‘clean’ or ‘viral’ within the antivirus
logs. The grep command includes a regex expression:
logs. The grep command includes a regex expression:
Table 3-7
grep
Command Options
Option
Description
-C
Provides lines of context around the grep pattern found.
Enter a value to specify the number of lines to include.
Enter a value to specify the number of lines to include.
-e
Enter a regular expression.
-i
Ignores case sensitivities.
-p
Paginates the output.
-t
Runs the grep command over the tail of the log file.
regex
Enter a regular expression.
Code Example 3-136 grep-Search for Text in a Log File
mail3.example.com> grep "CLEAN\\|VIRAL" antivirus
Fri Jun 9 21:50:25 2006 Info: sophos antivirus - MID 1 - Result 'CLEAN' ()
Fri Jun 9 21:53:15 2006 Info: sophos antivirus - MID 2 - Result 'CLEAN' ()
Fri Jun 9 22:47:41 2006 Info: sophos antivirus - MID 3 - Result 'CLEAN' ()
Fri Jun 9 22:47:41 2006 Info: sophos antivirus - MID 4 - Result 'CLEAN' ()
Fri Jun 9 22:47:41 2006 Info: sophos antivirus - MID 5 - Result 'CLEAN' ()
Fri Jun 9 22:47:41 2006 Info: sophos antivirus - MID 6 - Result 'CLEAN' ()
Fri Jun 9 22:47:42 2006 Info: sophos antivirus - MID 12 - Result 'CLEAN' ()
Fri Jun 9 22:53:04 2006 Info: sophos antivirus - MID 18 - Result 'VIRAL' ()
Fri Jun 9 22:53:05 2006 Info: sophos antivirus - MID 16 - Result 'VIRAL' ()
Fri Jun 9 22:53:06 2006 Info: sophos antivirus - MID 19 - Result 'VIRAL' ()
Fri Jun 9 22:53:07 2006 Info: sophos antivirus - MID 21 - Result 'VIRAL' ()
Fri Jun 9 22:53:08 2006 Info: sophos antivirus - MID 20 - Result 'VIRAL' ()
Fri Jun 9 22:53:08 2006 Info: sophos antivirus - MID 22 - Result 'VIRAL' ()
mail3.example.com>