Find the answer to your Linux question:
Results 1 to 4 of 4
hi! Is it possible with AWK make a division? For example, in a: more /tmp/file.log | awk '{print $1,$4,$5,$7,$11}' I would like to make a division ( $11/1000000 ) of ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48

    Division in AWK

    hi! Is it possible with AWK make a division?
    For example, in a:

    more /tmp/file.log | awk '{print $1,$4,$5,$7,$11}'

    I would like to make a division ($11/1000000) of the colum $11

    Is it possible???

  2. #2
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48
    anybody help me?

  3. #3
    drl
    drl is online now
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    Perhaps you could experiment with something like:
    Code:
    echo "1 2" | awk '{print $2/5}'
    producing:
    Code:
    0.4
    with version
    Code:
    GNU Awk 3.1.5
    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48
    very thanks!
    I'm going to experiment with this!

Posting Permissions

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