This is my code
awk '{a[$1":"$5]}
END{for(i in a)
{
split(i,b,":");
split(b[2],c,"[");
print b[1],b[2]
}
}' /var/log/messages
The output would be: (display Month and the Process name)
May init
May rhsmd
May kernal
I would like to change the process name to a short description. The short description is base on the "man" document.
This command help me to print what I want.
man init | sed -n '6p' | cut -c 8-
Output:
init - Upstart process management daemon
Finally, I can't find a way to embed the "man" code to awk. Below is what I expected final output, How can I do that? Thank you.
May init - Upstart process management daemon
May rhsmd - A Program for querying the Red Hat Network for updates and information
May kernal
There has some sample of /var/log/messages
May 21 03:30:02 redhat rhsmd: This system is registered to RHN Classic.
Sep 22 03:35:02 redhat rhsmd: This system is registered to RHN Classic.
May 22 13:00:31 redhat init: serial (hvc0) main process (1326) killed by TERM signal
May 22 13:00:31 redhat init: tty (/dev/tty6) main process (1336) killed by TERM signal
May 22 13:00:32 redhat rhnsd[1256]: Exiting