Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: gawk help  (Read 4690 times)

0 Members and 1 Guest are viewing this topic.

aabbasi

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    gawk help
    « on: February 21, 2011, 11:14:26 PM »
    Someone help please. I tried to do it with findstr but I couldn't, so now I'm trying to output the following numbers from this text file with gawk (what I need is in bold down below):


    Analyzing pool.ntp.org (1 of 1)...
    delayoffset from local clock
    Stratum: 2

    Warning:
    Reverse name resolution is best effort. It may not be
    correct since RefID field in time packets differs across
    NTP implementations and may not be using IP addresses.
                                                                         
                                                                         
                                                                         
    pool.ntp.org[155.101.3.115:123]:
        ICMP: 73ms
        NTP: +0.0162516s       RefID: 127-67-113-92.pool.ukrtel.net [92.113.67.127]


    What I want to output is in bold. How can I do this with Gawk? With my limited knowledge I can only output:
     
    Code: [Select]
    +0.0162516s       RefID
    But I would like to just have
    Code: [Select]
    0.0162516
    Is this possible?

    ghostdog74



      Specialist

      Thanked: 27
      Re: gawk help
      « Reply #1 on: February 24, 2011, 07:07:11 AM »
      Code: [Select]
      C:\test>gawk "/NTP:/{print $2}" file
      +0.0162516s