Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. AnotherAlan

    Using AWK to pad empty fields

    Works perfectly, thanks again PHV.
  2. AnotherAlan

    Using AWK to pad empty fields

    Thank you PHV, thats a great solution. Let me try it out. Really appreciate the help.
  3. AnotherAlan

    Using AWK to pad empty fields

    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...
  4. AnotherAlan

    Get second part of line with SED

    An AWK solution....dont bite, i'm just bored awk '{for(i=1;i<NF;i++)if($i=="release") print $(i+1)}' /etc/*release
  5. AnotherAlan

    Using sed to match text and print backward and forward to a marker

    The PHV solution gave me a heads up on something I was attempting to do, so thanks for that and a star. Alan
  6. AnotherAlan

    Print fields between two delimiters

    Cool, more tricks to add to the awk armoury. Thanks
  7. AnotherAlan

    Print fields between two delimiters

    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
  8. AnotherAlan

    Print fields between two delimiters

    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...
  9. AnotherAlan

    Print fields between two delimiters

    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...
  10. AnotherAlan

    Calculations dependant on value of two fields

    Today I have learnt more AWK'ness from the Masters...Thank you Gentlemen. Appreciate the effrots Alan
  11. AnotherAlan

    Calculations dependant on value of two fields

    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...
  12. AnotherAlan

    Calculations dependant on value of two fields

    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...
  13. AnotherAlan

    Cronjob of python script removing commas

    Just for good order I found a solution to put in the python script; def main(argv): locale.setlocale(locale.LC_ALL, 'en_US') Thanks
  14. AnotherAlan

    Cronjob of python script removing commas

    Thanks again Gents, this has now worked perfectly. If I could award more stars I would. Appreciate all the help. Alan
  15. AnotherAlan

    Cronjob of python script removing commas

    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"...
  16. AnotherAlan

    Cronjob of python script removing commas

    Thanks Guys, Cron is using POSIX values. I'll use an environment file to change these.
  17. AnotherAlan

    Cronjob of python script removing commas

    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...
  18. AnotherAlan

    Cronjob of python script removing commas

    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...
  19. AnotherAlan

    This script producing strange errors

    Good point SamBones, thanks.
  20. AnotherAlan

    This script producing strange errors

    That is it...fantastic, thanks Feherke.

Part and Inventory Search

Back
Top