On 12/29/2010 11:52 AM, David Kramer wrote:
> Is there a linux tool that can work as a pipe (read stdin, write to stdout) 
> and colorize any text
> matching an regex?  If not, I'll have to write one.  Not that hard, but I 
> would hate to reinvent
> it.
While I'm not specifically answering this, I do want to comment on
terminology. First, a PIPE is a channel that can connect 2 ports. In
this case, the output of 1 program to the input of another program. A
Unix program that reads from stdin and outputs to stdout (most Unix
commands) is called a FILTER when used in this context. For instance,
the pr(1) command is almost always used in this context. As also
mentioned, grep(1) is also a filter, and many times it is:
cat foo | grep <pattern> | grep -v <excluded stuff>
This is kind of an example of using grep as a filter.

I don't think that grep is the answer, but sed(1) is another command
that can alter a line of text based upon regular expressions. I don't
know exactly what you mean by colorize, but you certainly can take one
or more patterns(regex) and convert them to whatever you want.

-- 
Jerry Feldman <g...@blu.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846


_______________________________________________
Discuss mailing list
Discuss@blu.org
http://lists.blu.org/mailman/listinfo/discuss

Reply via email to