Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    5

    Unanswered: awk syntax problem?

    could any one tell me the error in the script here...

    it says

    awk: syntax error near line 15
    awk: bailing out near line 15


    ... the awk script is attached

    #This awk script collects the undec neighbour info
    #
    BEGIN {
    printf "SOURCE\tSECTOR\tPNPHASE\tLEVEL\t\REFERENCE\n"
    }
    /Primary/ {
    srce=$4;
    sector=$6;
    reference=$10;
    getline;
    pnphase=$6;
    level=$8/-2;

    }

    if (reference==no) then
    /Ref: yes/ {
    reference_pnoffset=$6;
    else
    reference_pnoffset="SAME";
    endif

    print srce"\t"sector"\t"pnphase"\t"level"\t"reference_pn offset
    }

    ===============
    My input file looks as attcahed

    ================================================== =====================
    Record: 24950188 Version: 2 Timestamp: Mon Jun 7 15:00:06 2004
    Primary (Reporting) Cell: 30 Sector: 3 Carrier: 1 Ref: yes Event: 46988
    Missing Pilot: Keep: 1 PN-Phase: 0x0191 Strength: 25
    Secondary Sector Information:
    Slot 1: Keep: 1 Pn_offset: 72 Strength: 26 Ref: no
    ================================================== =====================
    Record: 24950189 Version: 2 Timestamp: Mon Jun 7 15:00:06 2004
    Primary (Reporting) Cell: 30 Sector: 3 Carrier: 2 Ref: no Event: 46989
    Missing Pilot: Keep: 1 PN-Phase: 0x7456 Strength: 26
    Secondary Sector Information:
    Slot 1: Keep: 1 Pn_offset: 357 Strength: 28 Ref: yes
    Slot 2: Keep: 1 Pn_offset: 393 Strength: 29 Ref: no
    ================================================== =====================
    Record: 24950190 Version: 2 Timestamp: Mon Jun 7 15:00:06 2004
    Primary (Reporting) Cell: 30 Sector: 3 Carrier: 2 Ref: no Event: 46990
    Missing Pilot: Keep: 1 PN-Phase: 0x7456 Strength: 25
    Secondary Sector Information:
    Slot 1: Keep: 1 Pn_offset: 357 Strength: 27 Ref: yes
    Slot 2: Keep: 1 Pn_offset: 393 Strength: 30 Ref: no
    ================================================== =====================
    Record: 24950191 Version: 2 Timestamp: Mon Jun 7 15:00:06 2004
    Primary (Reporting) Cell: 30 Sector: 3 Carrier: 2 Ref: no Event: 46991
    Missing Pilot: Keep: 1 PN-Phase: 0x7456 Strength: 22
    Secondary Sector Information:
    Slot 1: Keep: 1 Pn_offset: 357 Strength: 27 Ref: yes
    Slot 2: Keep: 1 Pn_offset: 393 Strength: 32 Ref: no
    ================================================== =====================
    ...........................
    what my code is attempting to do is.....

    If in the second line of every record the Ref:no is set then i need to pick up the Pn_offset: value for the next line where Ref: yes is set.

    Ref:no Ref:yes Pn_offset:



    Now it 's alittle bit more clear i hope.....

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    # I [bold]think[/bold] that's what you meant
    #
    (reference==no) {
    if ($0 ~ /Ref: yes/ )
    reference_pnoffset=$6;
    else
    reference_pnoffset="SAME";

    print srce"\t"sector"\t"pnphase"\t"level"\t"reference_pn offset
    }

Posting Permissions

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