awk and strftime/mktime - characters added to end of date/time conversion string
Hi,
I'm parsing log files using awk and changing their format to make them readable to a log file analyser. The awk command I'm using works fine, except for the date/time conversion. The log file I'm parsing has entries like this: Code:
2013-01-01 00:00:44 127.0.0.1 12345W@uni.edu 8hd86863gd 200 8042 http://journal.com Code:
127.0.0.1 8hd86863gd 12345W@uni.edu [01/Jan/2013:00:00:44 +0000] "GET http://journal.com HTTP/1.1" 200 8042 Code:
awk 'BEGIN {FS=OFS=" "} Code:
[01/Jan/2013:00:00:44 +000033] Thanks, jb |
Quote:
Code:
format = "%d/%b/%Y:%H:%M:%S %z" split($1,date,"-") split($2,time,":") Moreover, your script can be simplified by removing unnecessary stuff: Code:
awk '{ |
Quote:
Quote:
Code:
awk '{ |
You simply need semi-colons after each statement
|
All times are GMT -5. The time now is 01:09 PM. |