We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e943fc2 commit 665df65Copy full SHA for 665df65
rcg.pl
@@ -0,0 +1,34 @@
1
+#!/usr/bin/perl -w
2
+#
3
+# regexp coloured glasses - from Linux Server Hacks from O'Reilly
4
5
+# eg ./rcg "fatal" "BOLD . YELLOW . ON_WHITE" /var/adm/messages
6
7
+use strict;
8
+use Term::ANSIColor qw(:constants);
9
+
10
+my %target = ( );
11
12
+while (my $arg = shift) {
13
+ my $clr = shift;
14
15
+ if (($arg =~ /^-/) | !$clr) {
16
+ print "Usage: rcg [regex] [color] [regex] [color] ...\n";
17
+ exit(2);
18
+ }
19
20
+ #
21
+ # Ugly, lazy, pathetic hack here. [Unquote]
22
23
+ $target{$arg} = eval($clr);
24
25
+}
26
27
+my $rst = RESET;
28
29
+while(<>) {
30
+ foreach my $x (keys(%target)) {
31
+ s/($x)/$target{$x}$1$rst/g;
32
33
+ print
34
0 commit comments