Centos 6/RHEL using Remark command


You can use the remark command to syntax highlight syslog files and the output of programs such as ping, traceroute, make, gcc and others.

Highlight the text using regular expressions and specific rule formats.

First download the regex-markup program.

$ wget http://savannah.nongnu.org/download/regex-markup/regex-markup-0.10.0-1.x86_64.rpm

$ sudo rpm -Uvh regex-markup-0.10.0-1.x86_64.rpm

The syntax is:

command1 | remark /path/to/config
command2 arg1 arg2 | remark /path/to/config

Examples

$ ping -c 4 minimallinux.blogspot.com | remark /usr/share/regex-markup/ping

PING blogspot.l.google.com (173.194.34.76) 56(84) bytes of data.
64 bytes from lhr14s19-in-f12.1e100.net (173.194.34.76): icmp_seq=1 ttl=54 time=16.8 ms
64 bytes from lhr14s19-in-f12.1e100.net (173.194.34.76): icmp_seq=2 ttl=56 time=17.9 ms
64 bytes from lhr14s19-in-f12.1e100.net (173.194.34.76): icmp_seq=3 ttl=56 time=16.8 ms
64 bytes from lhr14s19-in-f12.1e100.net (173.194.34.76): icmp_seq=4 ttl=56 time=17.7 ms

$ ping -c 6 minimallinux.blogspot.com | remark /usr/share/regex-markup/traceroute


PING blogspot.l.google.com (173.194.41.75) 56(84) bytes of data.
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=1 ttl=56 time=18.8 ms
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=2 ttl=54 time=18.0 ms
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=3 ttl=54 time=18.8 ms
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=4 ttl=56 time=18.8 ms
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=5 ttl=54 time=19.3 ms
64 bytes from lhr08s01-in-f11.1e100.net (173.194.41.75): icmp_seq=6 ttl=56 time=17.9 ms

Create a bash shell function and add it to your ~/.bashrc file:

ping() { /bin/ping $@ | remark /usr/share/regex-markup/ping; }

Go here for more examples

Labels: , , ,