Monday, 15 April 2013

bash - how i grep for certain log lines -



bash - how i grep for certain log lines -

i have next logs (removed unnecessary info) :

feb 18 11:38:54 kingston dhcpd: dhcpack feb 18 11:39:01 duxbury /usr/sbin/cron[27892]: feb 18 17:39:01 ruby /usr/sbin/cron[13080]:

how can grep server name (kingston, ruby or duxbury) while ensuring date/time info next server name? instance grep kingston, , homecoming "feb 18 11:38:54 kingston dhcpd: dhcpack" if "some info kingston" (no date/time info) available, nil returned. help!

grep -e "^[a-za-z]+ [0-9]+ [0-9]+:[0-9]+:[0-9]+ kingston"

bash grep debian rsyslog

No comments:

Post a Comment