Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, using GNU/Linux I need to get the difference between 100 and the column I printed via awk... >awk 'NR==7' tstsoa1disk line 7=98, how can I add a script that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2013
    Location
    Manila
    Posts
    17

    Question Awk Calculations


    Hi, using GNU/Linux

    I need to get the difference between 100 and the column I printed via awk...

    >awk 'NR==7' tstsoa1disk

    line 7=98, how can I add a script that will subtract 100 and 98?

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    477
    here's one way to do it:

    expr 100 - `awk 'NR==7' tstsoa1disk`
    the sun is new every day (heraclitus)

  3. #3
    Just Joined!
    Join Date
    Feb 2013
    Location
    Manila
    Posts
    17
    Quote Originally Posted by tpl View Post
    here's one way to do it:

    expr 100 - `awk 'NR==7' tstsoa1disk`
    expr:Syntax error

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •