Thursday, April 19, 2012

Using sed to replace all stdout from within .bashrc

I want to conduct a sed operation on all output in my bash shell. Basically I want to put the sed command in .bashrc so it "listens" for certain keywords to do something with them.



For instance I am looking to put something like this in .bashrc:




sed ''/critical/s//$(printf "CRITICAL")/g''




So that anytime the word "critical" pops up, it is changed to "CRITICAL". This might be when I cat a file, am using vi, or am telnetted into another system. What do I need to do to get this to work?





No comments:

Post a Comment