[wplug] piping grep

Alheid, Gregory alheidgj at upmc.edu
Wed Jun 17 10:19:10 EDT 2009


On Wed, Jun 17, 2009 at 9:10 PM, Arnaud [lists at arnaudloos.com] wrote:
> I'm trying to craft a bash statement that will output all the failed ssh
> connections for the current day. The auth log starts each entry with a date
> stamp like "Jun 17".
>
> This gives me my desired output:
> grep 'Failed password' /var/log/auth.log | grep 'Jun 17'
>
> And so I assumed this would too:
> grep 'Failed password' /var/log/auth.log | grep "date +'%b %d'"
>
>I know I'm having a problem with the nested quotes but I'm not sure how. Can
>someone set me straight.

How about

  dt=` date "+%b %d"` ; grep "^$dt .* Failed password" /var/log/auth.log




More information about the wplug mailing list