Hello all!
I'm trying to put together a grep command that will search a file (audit.log) for USERNAME=
n where
n is an unknown string and DATETIME=
n n where both
n's represent two 3-character values (day and month).
Here's what I have so far:
Code:
grep -ow "USERNAME=\w\{1,13\}\|DATETIME=\w\{1,3\}" audit.log* > test
And the output looks like this:
Code:
audit.log:USERNAME=USTRELA
audit.log:DATETIME=Wed
Obviously I'm getting the day, but the 3-character month (eg Jan, Feb, etc.) should be included to look something like this:
Code:
audit.log:USERNAME=USTRELA
audit.log:DATETIME=Wed Aug
Can anyone be so kind as to help me? I've played with the above command quite a bit, but no dice
Bonus if you can help me with the command to show just the month (I'm at a loss there and suspect I'd need to get awk involved...) :
Code:
audit.log:USERNAME=USTRELA
audit.log:DATETIME=Aug