Hi,
i'm writing a script that greps the logs based on month/date.
when i found this:
Code:
Oct 1 14:41:01 ubuntu CRON[2446]: pam_unix(cron:session): session closed for user smmsp
Oct 1 14:44:55 ubuntu gnome-screensaver-dialog: gkr-pam: unlocked login keyring
Oct 1 14:58:06 ubuntu gnome-screensaver-dialog: gkr-pam: unlocked login keyring
as you can see it doesn't record the date as "Oct 01" and instead of "Oct 1" it has a a space for the 0 thus becoming "Oct 1" (double spaced)
but when the date changes to something with 2 digits like "Aug 14" its normal:
Code:
Aug 14 12:17:01 ubuntu CRON[2052]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 14 12:17:01 ubuntu CRON[2052]: pam_unix(cron:session): session closed for user root
so my static code to grep the date doesn't work. i'm using ubuntu and the logs were from /var/logs/auth.log
my code was:
Code:
SEARCHDATE=$(date +%b\ %d)
any comments on how to get this working? thnaks.