Hi All,
I am using AWK to parse lines of a logfile to extract pertinent data but have hit a problem that I'm not even sure I can solve with AWK.
Within the logline I have three bracketed sections; the first of which are the fixed fields. i.e There are always seven values. The second and third...
That is cunning and very clever, thanks Feherke. If I could award another star I would.
A lesson in thinking around the problem rather than just bulldozing my way in with complexity.
Appreciate the guidance as always.
Alan
Hi Feherke, thanks for the speedy reply.
May I ask another, just for my learning benefit. Feel free to ignore it of course, having already provided an answer ;-)
Using the same examples, if I wanted to print just fields between "AFTER" and "took" and then the numerals after "took"; bearing in...
...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...
Fabulous, thanks very much PHV.
Ugly looking statement now but it works;
awk -F, '{lhs=$6*($10<1000000?1000000:$10);rhs=($7<1000000?1000000:$7)*$9;tot=($7<1000000?1000000:$7)+($10<1000000?1000000:$10);sum=(lhs+rhs)/tot};{print $2,$6,$7,$9,$10,$(NF-3),$(NF-2),$(NF-1),$NF,sum}'
Much...
...use 1m as the value(s).
So, if the value of $7 is 200,000 then substitute the value, in the calculation only, for 1,000,000.
awk -F, '{lhs=$6*$10;rhs=$7*$9;tot=$7+$10;sum=(lhs+rhs)/tot};{print $2,$6,$7,$9,$10,$(NF-3),$(NF-2),$(NF-1),$NF,sum}' myfile
Not entirely sure this can be done in...
...The script is called via another script;
[code] #!/bin/sh
LOCATION=London
EMAIL_TO="<list of emails>"
fill_file=`ls /app/logs/loonix/Fills-*.log | head -n1`
tick_file=`ls /app/logs/loonix/Ticks-*.log | head -n1`
echo "Using fills file $fill_file"
echo "Using ticks file $tick_file"
python...
Hi,
I have a python script that produces a report detailing amounts.
When run from the command line it produces the report in the correct format. When run from con it omits the commas.
I'm guessing that this has something to do with the shell it runs under, however, I have tested this from...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.