line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package cet; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22730
|
use 5.008_005; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
85
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
cet - console emphasis tool |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 2.02 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '2.02'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
cet.pl REGEX1 [COLOR1] [REGEX2 [COLOR2]] ... [REGEXn [COLORn]] |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
cet.pl is a command line tool for visually emphasizing text in log files |
28
|
|
|
|
|
|
|
etc. by colorizing the output matching regular expressions. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 USAGE |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
REGEX is any regular expression recognized by Perl. For some shells |
34
|
|
|
|
|
|
|
this must be enclosed in double quotes ("") to prevent the shell from |
35
|
|
|
|
|
|
|
interpolating special characters like * or ?. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
COLOR is any ANSI color string accepted by Term::ANSIColor, such as |
38
|
|
|
|
|
|
|
'green' or 'bold red'. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Any number of REGEX-COLOR pairs may be specified. If the number of |
41
|
|
|
|
|
|
|
arguments is odd (i.e. no COLOR is specified for the last REGEX) cet.pl |
42
|
|
|
|
|
|
|
will use 'bold yellow'. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Overlapping rules are supported. For characters that match multiple rules, |
45
|
|
|
|
|
|
|
only the last rule will be applied. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 EXAMPLES |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
In a system log, emphasize the words "error" and "ok": |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
tail -f /var/log/messages | cet.pl error red ok green |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
In a mail server log, show all email addresses between <> in white, |
59
|
|
|
|
|
|
|
successes in green: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
tail -f /var/log/maillog | cet.pl "(?<=\<)[\w\-\.]+?\@[\w\-\.]+?(?=\>)" "bold white" "stored message|delivered ok" "bold green" |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=back |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
In a web server log, show all URIs in yellow: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
tail -f /var/log/httpd/access_log | cet.pl "(?<=\"get).+?\s" |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Multi-line matching is not implemented. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
All regular expressions are matched without case sensitivity. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 EXPORT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Nothing. You should not attempt to use this module for anything. Perhaps |
85
|
|
|
|
|
|
|
what you are really looking for is the script: B |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Andreas Lund, Efloyd@atc.noE, C Hutchinson, Etaint@cpan.orgE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 MAINTAINER |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
C Hutchinson C |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 BUGS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
100
|
|
|
|
|
|
|
or through the web interface at |
101
|
|
|
|
|
|
|
L. I will be |
102
|
|
|
|
|
|
|
notified, and then you'll automatically be notified of progress on your |
103
|
|
|
|
|
|
|
bug as I make changes. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SUPPORT |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
perldoc cet |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
You can also look for information at: |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over 4 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * CPAN Ratings |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * Search CPAN |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
L |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Copyright 2009-2013 Andreas Lund |
141
|
|
|
|
|
|
|
Copyright 2013 C Hutchinson |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
146
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; # End of cet |