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...
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...
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...
Hi All,
Ive written some code to calculate a mid point based on the data in four fields. I would like to include another logical check to establish if either of two fields are less than 1,000,000, and if so use 1,000,000 as the value.
i.e. if either (or both) of $7 and $10 are less than 1m...
Hmmm, may need some further assistance here. I've tried changing the locale settings in the wrapper script send_report_for_london.sh but its still not working.
#!/bin/bash
LANG="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"...
Hi Feherke, thanks for the quick reply;
The python script is over 500 lines long but the most pertinent part of it is this;
def convert(value,dttype=STR_TYPE):
321 if dttype==AMT_TYPE: # make sure to format it as 100,000,000.00
322 return locale.format('%d', value...
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.