0

I have the following 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 I grep for a server name (kingston, ruby or duxbury) while ensuring that date/time info is next to the server name? so for instance I could grep for kingston, and it would return "Feb 18 11:38:54 Kingston dhcpd: DHCPACK" but if only "some data Kingston" (no date/time info) was available, then nothing would be returned. Thanks for the help!

lacrosse1991
  • 2,972
  • 7
  • 38
  • 47

1 Answers1

2
grep -E "^[a-zA-Z]+ [0-9]+ [0-9]+:[0-9]+:[0-9]+ Kingston"
ty733420
  • 894
  • 7
  • 13