I want to highlight the Use% column if it reaches above 80. Any color is fine but I want it with full output.
Filesystem Size Used Avail Use% Mounted on
devtmpfs 6.3G 0 6.3G 0% /dev
tmpfs 6.3G 4.0K 6.3G 1% /dev/shm
tmpfs 6.3G 1.1G 5.2G 18% /run
tmpfs 6.3G 0 6.3G 0% /sys/fs/cgroup
/dev/mapper/os-root 9.5G 7.1G 2.0G 79% /
/dev/mapper/os-var 60G 37G 21G 65% /var
/dev/mapper/os-varlog 15G 11G 3.4G 77% /var/log
/dev/vda3 197M 173M 25M 88% /boot
tmpfs 1.3G 0 1.3G 0% /run/user/0
For example, in my case,
Filesystem Size Used Avail Use% Mounted on
devtmpfs 6.3G 0 6.3G 0% /dev
tmpfs 6.3G 4.0K 6.3G 1% /dev/shm
tmpfs 6.3G 1.1G 5.2G 18% /run
tmpfs 6.3G 0 6.3G 0% /sys/fs/cgroup
/dev/mapper/os-root 9.5G 7.1G 2.0G 79% /
/dev/mapper/os-var 60G 37G 21G 65% /var
/dev/mapper/os-varlog 15G 11G 3.4G 77% /var/log
**/dev/vda3 197M 173M 25M 88% /boot** -->* 88% color should change here.*
tmpfs 1.3G 0 1.3G 0% /run/user/0
is it possible? or not? please help me guys. Sorry for my bad English.
You can do it like this:
with perl:
Or with just bash:
Or even with awk:
The basic idea is to use
terminfodatabase to not hardcode terminal escape sequences.I use
tputwith the sequence names fromman terminfoto get the right code in terminal.Eg.
more info at http://www.gnu.org/software/termutils/