I have a log file with contents within the file having the date format as follows on some lines:
Sep 5, 2010
Now, I am trying to run a script to parse through the log file. Since I want to grep all the entries for today's date, I use the date command:
date '+%b %e, %Y'
The problem is, %e should return "Sep(doublespace)5, 2010" (notice double space after 'Sep' - I have not tried this as today is 30th September but just assumuing based on the date manual page which says the day will be preceeded by white space), thus it is not able to grep the exact string I want which is "Sep(singlespace)5, 2010" (notice single space after 5). I thought this should be easy with some experts out there.
Also, %d will not work since it preceeds the single digit days with a 0 (zero) whereas my log file does not have a preceeding 0 (zero) for single digit days.
Also, would like to know if I can get rid of this by doing a sed command - would like to avoid it though. Please advice.