AnotherAlan
Technical User
Hi All,
Just a quick puzzle really as I have found a suitable workaround, but I was attempting to print the fields from the below example loglines from the word AFTER to the numerals after the word took;
i.e. AFTER Initial lock of quote took 13
AFTER getData for 46681 took 0
2011-05-17 [[ACTIVE] ExecuteThread: '186' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO QuoteServiceImpl - AFTER Initial lock of quote took 13 ms for quote 4
2011-05-17 [[ACTIVE] ExecuteThread: '186' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO QuoteServiceImpl - AFTER getData for 46681 took 0 ms for quote 4
Although I could get the field number for AFTER using a for loop I couldn't work out how to put an end delimiter to it.
Anyway, I got what I needed by using awk and sed;
nawk -F- '/AFTER/ {print $5}' | sed s'/ms.*//g'
but was interested if there was an Awk solution.
Thanks
Just a quick puzzle really as I have found a suitable workaround, but I was attempting to print the fields from the below example loglines from the word AFTER to the numerals after the word took;
i.e. AFTER Initial lock of quote took 13
AFTER getData for 46681 took 0
2011-05-17 [[ACTIVE] ExecuteThread: '186' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO QuoteServiceImpl - AFTER Initial lock of quote took 13 ms for quote 4
2011-05-17 [[ACTIVE] ExecuteThread: '186' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO QuoteServiceImpl - AFTER getData for 46681 took 0 ms for quote 4
Although I could get the field number for AFTER using a for loop I couldn't work out how to put an end delimiter to it.
Anyway, I got what I needed by using awk and sed;
nawk -F- '/AFTER/ {print $5}' | sed s'/ms.*//g'
but was interested if there was an Awk solution.
Thanks