Highlight

| | Comments (0)
Maybe something like this already exists, but I just wrote a quick little script that I call "highlight." It takes one argument, then reads STDIN and highlights that string on output with ANSI coloring (red).

#!/usr/bin/perl
my $word = shift;
while (<>) {
    s/\Q$word\E/\e[31m$word\e[0m/g;
    print;
}

So I can do fun things like:

% somebigdebuggingoutput | highlight 'what i am looking for'

It works great in conjunction with ls, locate, grep, etc. use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on December 15, 2004 3:00 PM.

The Daily Show Phenomenon was the previous entry in this site.

Music RSS Feed is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.