Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use sed to add background color to tabs?

Tags:

linux

unix

sed

Is possible to use sed to change the background color of tabs (or any other text), so that, for example, I could run something like the following?

somefunction | sed -e 's/(some pattern)/(set bg color)\1(unset bg color)/g'
like image 646
jonderry Avatar asked Apr 07 '11 01:04

jonderry


1 Answers

Yes:

#!/bin/bash

norm_bg=$(tput sgr0)
red_bg=$(tput setab 1)

echo -e "foo\tbar\tbaz" | sed "s/\t/$red_bg    $norm_bg/g"

See this link for other Color Codes (very bottom)

terminal

like image 97
SiegeX Avatar answered Nov 13 '22 23:11

SiegeX