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

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

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

    ...LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LOCATION=London EMAIL_TO="email list" 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...
  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

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