Now most of the time I am only interested in the time ( the first column) and a column that begins with etime i.e etime=someNumber. This column seems to shift around so I cant do a simple awk based on the column number. Is there a way to search for the word etime and output the etime=Xyz?
Hope I communicated what I was trying to do.I basically need to extract the field based on a partial match.
Hi Franklin52
Thank for posting but the solution doesnt seem to be working. It is not only printing entire lines it is also printing lines without etimes.
I would require an output like
[2011-04-06T17:57:15.661-07:00] etime=3,712
or better yet
2011-04-06 17:57:15 etime=3,712
for lines with etimes, and nothing for lines without etimes
currently i am using
grep -etime filename | awk '{print $1 " " $32}'
But as I explained earlier the etime field moves around and hence I miss out on certain output.
Hi Franklin
Could you please explain what you are doing with the statements? I am relatively new to sed and awk and would appreciate the help. This way I can try and figure out if the code you wrote needs to be modified in a certain way for it to work on my system or file.
Would it help if I attached a few more lines of logs?
Thanks
Hi Kurumi
Thanks for your reply.could you please explain your code? Also is it possible to print the time and etime on the same line?
does the ~/etime/ mean anything which contains an etime?
I managed to hack together a code, that works ( based on the fact the time is always column 1 and ~/etime/ from your code ) but it would be really useful if you could explain the logic behind the script you created.