Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Feb 2013
Color Codes on Single Characters?
I've been reading up on colorizing the shell but haven't found much luck coaxing particular sorts of output to be colored.
I have a script that inserts characters at specific positions along on a line made of hyphens. The replacement works as planned (using awk), but I was wondering if there was a small color code any of you might know of that I can insert along with the replaced character.
The substitution of hyphens to characters is loop-based (iterative), so I realize that adding such a color code would shift the position for the next substitution, every time the loop runs. I would work around that by adding the length of the color code to the loop that substitutes characters so I'm not too worried.
I can execute certan color escapes with echo -e but I want to preserve newlines in the output, so I'm going to want to use printf instead, to interpret the color codes after the character replacements are done, giving colored output on those replaced characters. Does anybody know how this is done with printf?
If there is no computationally inexpensive (relatively) way to do this, could any of you more experienced gurus perhaps direct me to a particular software? Can certain builds of AWK handle color codes, for example?