Is there a grep -like command to highlight specific text in a command's output, but shows all lines irrespective of the presence of the desired text and allows one to interact with the piped(1) or monitored(2) command?
command | highlightThisText 'string1' 'string2' 'string3'- as in how the
timecommand works to time a command, e.g.time echo foo
My scenario is as such.:
I have a server with Ubuntu Server 14.04.2 which needs an HP driver specific to the kernel shipped with 14.04.2. I can't do apt-get update ; apt-get upgrade willy-nilly because a kernel update could hose the OS's ability to access the RAID controller. I'm doing apt-get --only-upgrade install packagename to upgrade existing packages one at a time. At a minimum, I'd like
- "Suggested packages:"
- "The following packages will be upgraded:"
- "The following extra packages will be installed:"
to be highlighted like a grep statement would, but I also need to interact with the prompts. The highlighting would make it faster to visually pick out which packages are being fetched.
As I was finalizing this post, I was choosing tags and came across source-highlight. This seems close, but it looks that only produces highlighted output documents, not in-terminal colorized output.
UPDATE:
Someone commented (but apparently deleted) this post Convince grep to output all lines, not just those with matches may be what I'm looking for. It's very close to fitting my needs - specifically piping into ack and grep -E --color "Things I'd like highlighted" - but when I get to a portion where apt-get prompts me to continue "[Y/n]", it doesn't display anything. At that point, I know to press 'Y' or 'n', but if I wanted to use this for other commands, I may not know what to press if ack or grep is blocking the prompt.
As an example, below I'm using read and echo commands. read is waiting for input and doesn't colorize, but echo displays as it should.

expect, where you would run aninteractwith a series of regular expressions to match outputs, and use send_user to add coloring to them. On the other hand perhaps you just want to know how to pin the kernel package on ubuntu so it will not get upgraded? – icarus Jan 29 '17 at 04:21expectnow. That may work. Locking in the kernel version would help greatly. – user208145 Jan 29 '17 at 04:36hold. See for example http://askubuntu.com/questions/678630/how-can-i-avoid-kernel-updates – icarus Jan 29 '17 at 04:53