How would I go about colorizing the output of tail with sed?
echo "`tput setaf 1`foo`tput op`" works as expected
echo "foo" | sed -e 's/(foo)/`tput setaf 1`\0`tput op`/g' however, does not.
What am I missing here?
|
The backticks `` in the echo command spawn a process and it's output is substituted into the echo command line. You can see this with e.g.
This works because the contents of the The sed command you're using wraps everything in You can fix this by putting "" around your sed command
You also had an error in your sed command. The |
|||
|
|
|
Does it have to be
The above will highlight To make it print all lines and only highlight
|
|||||||||
|
grepdoes not. – syneticon-dj Nov 23 '12 at 22:58