Re:Colout – add colors to a text stream in your terminal
by nojhan on Friday June 07, 2013 @04:15AM
(#5837835)
You use the "zero or more" * operator, which will match empty strings in front of the "%". But an empty string cannot be converted to a float. Just use the "at least one" operator: +. Also, the scale is 0,100 by default, you can omit it.
df -h | colout "([0-9]+)%" scale
Re:Colout – add colors to a text stream in your terminal
by Fuzzwah on Friday June 07, 2013 @06:20PM
(#5842411)
Thanks for the response. My lazy regex makes me feel bad.
Re:Colout – add colors to a text stream in your terminal
by Fuzzwah on Thursday June 06, 2013 @06:29PM
(#5835596)
Also, the install docs mention python2.7 but after a bit of head to brickwall I realised that this is trying to use python3.
To get it working I needed to do:
sudo python3 setup.py install
And /usr/local/bin/colout was created for me (unlike what it mentions in the readme atm).
I can see a bunch of ways I'll make use of this. The first one I attempted to work on involved trying to color scale the use% in the output of a "df -h".
Alas it didn't work as I expected it:
However if I grep out just the /dev/sda line it does what I expected: The 17% is a pretty blue.Tips?