Results 1 to 13 of 13

Thread: Problem with awk

  1. #1
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Problem with awk

    Question:

    Will awk perform decimal point calculaiton or not?

    plz help


    Sharif.S


  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: Problem with awk

    Why not?

    Refer the following URL:
    Awk - A Tutorial and Introduction - by Bruce Barnett

    -------------------
    suresh


  3. #3
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    then wat cud be the reason for this output:-
    shell
    awk 'BEGIN{sum=0;}
    {sum=sum+(99999.99);
    print sum;
    }' filed

    Output
    100000
    200000
    300000
    400000
    500000
    600000
    700000
    800000
    900000
    1e+06
    1.1e+06
    1.2e+06
    1.3e+06
    1.4e+06


  4. #4
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    can someone pls look in to this..


  5. #5
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    Guys i have found the solution for the abv question..

    Thanks!
    Sharif.S


  6. #6
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: Problem with awk

    Whats the solution sharif?
    why that occurred?
    post it. we too will learn.

    Last edited by Barbie; 01-17-2007 at 01:42 AM.

  7. #7
    Expert Member
    Join Date
    Dec 2006
    Answers
    139

    Re: Problem with awk

    Hi SHerif,

    As i saw u posted a very intersting query .After that you yourself found a solution for that also. That's great but if u found a solution please share with us.

    Then we also come to know about the same problem's solution.

    Regards

    Nikhil Rattan


  8. #8
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    In awk there is settings parameter called OFMT which holds/defines the output format of numbers. by default its "%.6g". By increasing it we can achive desired results.

    sorry guys yesterday i was with urgent task to complete, so cudn't able to post solution.

    Thanks,
    Sharif


  9. #9
    Expert Member
    Join Date
    Dec 2006
    Answers
    139

    Re: Problem with awk

    Hi,

    Sheri,

    That was really i nice solution with complex query.

    Thanks to post solution.

    Regards

    Nikhil


  10. #10
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    Hey Nikhil,

    Just a change i want to mention. am sharif not sheri!!!!!!


    Cheers,
    Sharif


  11. #11
    Expert Member
    Join Date
    Dec 2006
    Answers
    139

    Re: Problem with awk

    oh oh

    Yap i mistyped that


    fine

    cheers!!!!!


    Nikhil Rattan


  12. #12
    Contributing Member
    Join Date
    Dec 2006
    Answers
    39

    Re: Problem with awk

    No Issues Nikhil..

    Cheers
    Sharif


  13. #13
    Expert Member
    Join Date
    Dec 2006
    Answers
    139

    Re: Problem with awk

    hi,

    Sorry Sharif,

    I mistyped that . I will take care about that for future.


    Regards

    Nikhil Rattan


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact