Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Awk Script Help 3

Status
Not open for further replies.

beaster

Technical User
Aug 20, 2001
225
US
I know very little, so please if you can help, make it as easy as possible for me to understand. I am getting better though thanks to everyone's help!

Here goes!

I have several files named file1, file2, file3, etc.

I would like to use nawk, and output the files to different
files named block_obj_1, block_obj_2, block_obj_3, and so on using the original file #
I do have a temp directory to send them to.

The internal file looks similiar to the below, but have different numbers in each file:

RXOTS-11-0-0 CONFIG 638 2 7 7481 TCH
RXOTS-11-0-1 CONFIG 638 2 6 7488 TCH
RXOTS-11-0-2 CONFIG 638 2 5 7503 TCH
RXOTX-11-0 CONFIG 638 2 45 YES NONE
RXOTX-11-1 CONFIG HOP 5 45 NO NONE
RXOTX-11-2 CONFIG HOP 6 45 NO NONE
RXOTX-11-4 CONFIG 629 1 45 YES NONE
RXORX-11-0 CONFIG HOP NONE
RXORX-11-1 CONFIG HOP NONE
RXORX-11-2 CONFIG HOP NONE
MO CELL CHGR
RXOTG-11 B00227A 0
B00227B 0
B00227C 0
B00227A 1
B00227B 1
B00227C 1
RXOTG-11

DEV DCP APUSAGE APSTATE TEI
RBLT24-264 1 UNDEF IDLE
RBLT24-265 2 UNDEF IDLE




I need to grep on the first field for RXOTS, RXOTX, and RXORX (In that order).

So it would only find:

RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4
RXORX-11-0
RXORX-11-1
RXORX-11-2

Then for every RXOTX it found it would create text below it like:
RXOTRX-11-0
RXOTRX-11-1
RXOTRX-11-2
RXOTRX-11-4 Basically it would just create a new line of text adding an R to it for each TX found.

So then my output would be:
RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4
RXORX-11-0
RXORX-11-1
RXORX-11-2
RXOTRX-11-0
RXOTRX-11-1
RXOTRX-11-2
RXOTRX-11-4

Below the TRX portion, I need the following added using the first number only (EXAMPLE BELOW):

RXOCON-11
RXODP-11
RXOIS-11
RXOTF-11
RXOCF-11
RXOTG-11

I want to end up with text similiar to below:

RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4
RXORX-11-0
RXORX-11-1
RXORX-11-2
RXOTRX-11-0
RXOTRX-11-1
RXOTRX-11-2
RXOTRX-11-4
RXOCON-11
RXODP-11
RXOIS-11
RXOTF-11
RXOCF-11
RXOTG-11

The first and second number will be different in each file1, file2 and so on. The only thing
uniq is RXOTS, RXOTX, RXORX.

I know this is alot, and is similiar to a former post, but it is different, I promise!

Thanks as always!

Beaster
 
I'm not sure if i am getting all the numbers fron the right places but this may get you started.
Code:
{
  if (FNR == 1) {
    if (NR>1) {
      for(j=0;j<num;j++) print &quot;RXOTRX-&quot; substr(a[j],7) > fn
      b = substr(a[0],7,2)
      print &quot;RXOTRX-&quot; b > fn
      print &quot;RXOCON-&quot; b > fn
      print &quot;RXODP-&quot; b > fn
      print &quot;RXOIS-&quot; b > fn
      print &quot;RXOTF-&quot; b > fn
      print &quot;RXOCF-&quot; b > fn
      print &quot;RXOTG-&quot; b > fn
      close(fn)
    }
    num = 0
    fnix++
    fn = &quot;block_obj_&quot; fnix
  }
  if ($1 ~ /^RXOTS/ || $1 ~ /^RXORX/) {print $1 > fn}
  if ($1 ~ /^RXOTX/) {a[num] = $1; num++; print $1 > fn}
}
END {
      for(j=0;j<num;j++) print &quot;RXOTRX-&quot; substr(a[j],7) > fn
      b = substr(a[0],7,2)
      print &quot;RXOTRX-&quot; b > fn
      print &quot;RXOCON-&quot; b > fn
      print &quot;RXODP-&quot; b > fn
      print &quot;RXOIS-&quot; b > fn
      print &quot;RXOTF-&quot; b > fn
      print &quot;RXOCF-&quot; b > fn
      print &quot;RXOTG-&quot; b > fn
}
CaKiwi
 
Cakiwi,
Just curious, why are you calling close when using &quot;>&quot; redirection? Is this necessary with some awk implementations on some platforms?
 
Here's to get you started. Save below in myAwk.awk [watch out for wrapped lines] and call it as 'nawk -f myAwk.awk file*'

#-----------------------------------------

BEGIN {
newNum=split(&quot;RXOCON RXODP RXOIS RXOTF RXOCF RXOTG&quot;, newFields, &quot; &quot;);
}


function printExtra(arr, i, tmp, tmpARR, firstDash) {
# printf(&quot;FILENAME->[%s]\n&quot;, FILENAME);
for (i in arr)
if ( i ~ &quot;^RXOTX-*&quot; ) {
tmp=i;
split(tmp, tmpARR, &quot;-&quot;);
firstDash=tmpARR[2];
gsub(&quot;^RXOTX*&quot;, &quot;RXOTRX&quot;, tmp);
print i >> outFile;
delete arr;

}

for (i=1; i <= newNum; i++)
printf(&quot;%s-%s\n&quot;, newFields, firstDash) >> outFile;

}

(NR != 1) && (FNR == 1) {
printExtra(arr);
}

FNR == 1 {
pos=match(FILENAME, &quot;[0-9][0-9]*&quot;);
outFileNum=substr(FILENAME, RSTART, RLENGTH);
#printf(&quot;outFile->[block_obj_%d]\n&quot;, outFileNum);
outFile=&quot;block_obj_&quot; outFileNum;
}

/(RXOTS|RXOTX|RXORX)/ { arr[$1]++; print $1 >> outFile; }

END {
printExtra(arr);
}
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
marsd,

I call close out of habit because some older awk implementations (and maybe some current ones) have a limited number of files that can be open at one time. CaKiwi
 
marsd and CaKiwi: the number of open stream is limited on some (not so old) implementations of awk.

I tried to write in 2000 files names glop1 to glop2000 without closing any of them in a single awk call.
Like this:
Code:
'BEGIN {for (i=0; i < 2000; i++) print &quot;glop&quot; > (&quot;glop&quot;i); print &quot;done&quot;}'

I get the following results:
Code:
AIX 10:
awk: Cannot open file glop194.
A maximum of 194 files can be open at one time.

Solaris 2.8 :
awk: line 0 (): too many open streams to print/printf onto &quot;glop252&quot;
nawk: glop20 makes too many open files

GNU awk:
done

In conclusion:
- close anything you no more need,
- use GNU awk !

 
CaKiwi,
Your first post worked great! Exactly what I needed.

There is only one issue, the RX shows up first in the output file. So it looks like:

RXORX
RXOTS
RXOTX

I really need it to be:

RXOTS
RXORX
RXOTX

Can you tell me what adjustment needs to be made to get to do that.

That is the only issue! Thanks Again! Beaster
 
I am sorry, it is also adding a single TRX-11.

It should only add a RXOTRX if there is a RXOTX with a - dash and another - meaning 11-11 not just 11.

Sorry, You guys have been a huge help with this!
 
Is this better?
Code:
{
  if (FNR == 1) {
    if (NR>1) {
      for(j=0;j<num;j++) print a[j] > fn
      for(j=0;j<num;j++) {
         print &quot;RXOTRX-&quot; substr(a[j],7) > fn
      }
      b = substr(a[0],7,2)
      print &quot;RXOCON-&quot; b > fn
      print &quot;RXODP-&quot; b > fn
      print &quot;RXOIS-&quot; b > fn
      print &quot;RXOTF-&quot; b > fn
      print &quot;RXOCF-&quot; b > fn
      print &quot;RXOTG-&quot; b > fn
      close(fn)
    }
    num = 0
    fnix++
    fn = &quot;block_obj_&quot; fnix
  }
  if ($1 ~ /^RXOTS/ || $1 ~ /^RXORX/) {print $1 > fn}
  if ($1 ~ /^RXOTX/) {a[num] = $1; num++ > fn}
}
END {
      for(j=0;j<num;j++) print a[j] > fn
      for(j=0;j<num;j++) {
        print &quot;RXOTRX-&quot; substr(a[j],7) > fn
      }
      b = substr(a[0],7,2)
      print &quot;RXOCON-&quot; b > fn
      print &quot;RXODP-&quot; b > fn
      print &quot;RXOIS-&quot; b > fn
      print &quot;RXOTF-&quot; b > fn
      print &quot;RXOCF-&quot; b > fn
      print &quot;RXOTG-&quot; b > fn
}
CaKiwi
 
Yes! It looks much better with only adding a TRX! It is still not putting it in the right order. The only ones out of order is:

RXORX
RXOTS
RXOTX

When it should be

RXOTS
RXORX
RXOTX

I think it is because your script is reading $1 and the way it is in the file is like the first text above. I really need it like my statement above.

This will such an awesome help to me when it is completed!

Beaster
 
This is the output I get from the data you supplied. What needs to be changed?
RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXORX-11-0
RXORX-11-1
RXORX-11-2
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4
RXOTRX-11-0
RXOTRX-11-1
RXOTRX-11-2
RXOTRX-11-4
RXOCON-11
RXODP-11
RXOIS-11
RXOTF-11
RXOCF-11
RXOTG-11 CaKiwi
 
CaKiwi,
You are right, you would end up with that data from above. That is my fault. In the file it is actually like:

RXORX-11-0
RXORX-11-1
RXORX-11-2
RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4


That was entirely my fault, everything else works fine, but if you run it against the data just above, you will see what I mean. The RX is printed first when I need it to be the TS, then RX, then TX.

I am entirely sorry for printing the input file date incorrect. Can you run it and see what I mean?

Beaster

 
How many types of input records are there, what are the possible orders in the input file and what determines the output order? CaKiwi
 
CaKiwi,
The number of input records will always vary. From 1 to maybe 190-200. It will be only one type. The only thing different in the files will be the numbers and maybe spaces. I will paste one entire input file below. The only output I want is from above:

Example output file if using the input file below:

RXOTS-11-0-0
RXOTS-11-0-1
RXOTS-11-0-2
RXOTS-11-0-3
RXOTS-11-0-4
RXOTS-11-0-5
RXOTS-11-0-6
RXOTS-11-0-7
RXOTS-11-1-0
RXOTS-11-1-1
RXOTS-11-1-2
RXOTS-11-1-3
RXOTS-11-1-4
RXOTS-11-1-5
RXOTS-11-1-6
RXOTS-11-1-7
RXOTS-11-2-0
RXOTS-11-2-1
RXOTS-11-2-2
RXOTS-11-2-3
RXOTS-11-2-4
RXOTS-11-2-5
RXOTS-11-2-6
RXOTS-11-2-7
RXOTS-11-4-0
RXOTS-11-4-1
RXOTS-11-4-2
RXOTS-11-4-3
RXOTS-11-4-4
RXOTS-11-4-5
RXOTS-11-4-6
RXOTS-11-4-7
RXOTS-11-5-0
RXOTS-11-5-1
RXOTS-11-5-2
RXOTS-11-5-3
RXOTS-11-5-4
RXOTS-11-5-5
RXOTS-11-5-6
RXOTS-11-5-7
RXOTS-11-6-0
RXOTS-11-6-1
RXOTS-11-6-2
RXOTS-11-6-3
RXOTS-11-6-4
RXOTS-11-6-5
RXOTS-11-6-6
RXOTS-11-6-7
RXOTS-11-8-0
RXOTS-11-8-1
RXOTS-11-8-2
RXOTS-11-8-3
RXOTS-11-8-4
RXOTS-11-8-5
RXOTS-11-8-6
RXOTS-11-8-7
RXOTS-11-10-0
RXOTS-11-10-1
RXOTS-11-10-2
RXOTS-11-10-3
RXOTS-11-10-4
RXOTS-11-10-5
RXOTS-11-10-6
RXOTS-11-10-7
RXORX-11-0
RXORX-11-1
RXORX-11-2
RXORX-11-4
RXORX-11-5
RXORX-11-6
RXORX-11-8
RXORX-11-10
RXOTX-11-0
RXOTX-11-1
RXOTX-11-2
RXOTX-11-4
RXOTX-11-5
RXOTX-11-6
RXOTX-11-8
RXOTX-11-10
RXOTRX-11-0
RXOTRX-11-1
RXOTRX-11-2
RXOTRX-11-4
RXOTRX-11-5
RXOTRX-11-6
RXOTRX-11-8
RXOTRX-11-10
RXOCON-11
RXODP-11
RXOIS-11
RXOTF-11
RXOCF-11
RXOTG-11



Example input file (Only the numbers in it will be different):

*** Connected to BH1BSC1 ***
<RXTCP:MO=RXOTG-11;


RADIO X-CEIVER ADMINISTRATION
TG TO CHANNEL GROUP CONNECTION DATA

MO CELL CHGR
RXOTG-11 B00227A 0
B00227B 0
B00227C 0
B00227A 1
B00227B 1
B00227C 1

END

<RXCDP:MO=RXOTG-11;

RADIO X-CEIVER ADMINISTRATION
MANAGED OBJECT CONFIGURATION DATA

MO RESULT ARFCN MISMATCH
RXORX-11-0 CONFIG HOP NONE
RXORX-11-1 CONFIG HOP NONE
RXORX-11-2 CONFIG HOP NONE
RXORX-11-4 CONFIG HOP NONE
RXORX-11-5 CONFIG HOP NONE
RXORX-11-6 CONFIG HOP NONE
RXORX-11-8 CONFIG HOP NONE
RXORX-11-10 CONFIG HOP NONE

MO RESULT ARFCN TXAD TN BPC CHCOMB OFFS XRA ICM
RXOTS-11-0-0 CONFIG 638 2 7 7481 TCH 0 NO ON
RXOTS-11-0-1 CONFIG 638 2 6 7488 TCH 0 NO ON
RXOTS-11-0-2 CONFIG 638 2 5 7503 TCH 0 NO ON
RXOTS-11-0-3 CONFIG 638 2 4 7508 TCH 0 NO ON
RXOTS-11-0-4 CONFIG 638 2 3 7520 TCH 0 NO ON
RXOTS-11-0-5 CONFIG 638 2 2 7542 TCH 0 NO ON
RXOTS-11-0-6 CONFIG HOP 5 1 7638 TCH 0 NO ON
RXOTS-11-0-7 CONFIG HOP 5 0 7707 TCH 0 NO ON
RXOTS-11-1-0 CONFIG HOP 5 7 7562 TCH 0 NO ON
RXOTS-11-1-1 CONFIG HOP 5 6 7573 TCH 0 NO ON
RXOTS-11-1-2 CONFIG HOP 5 5 7578 TCH 0 NO ON
RXOTS-11-1-3 CONFIG HOP 5 4 7603 TCH 0 NO ON
RXOTS-11-1-4 CONFIG HOP 5 3 7611 TCH 0 NO ON
RXOTS-11-1-5 CONFIG HOP 5 2 7635 TCH 0 NO ON
RXOTS-11-1-6 CONFIG HOP 6 1 7663 TCH 0 NO ON
RXOTS-11-1-7 CONFIG HOP 6 0 7708 TCH 0 NO ON
RXOTS-11-2-0 CONFIG 638 2 0 7942 BCCH 0 NO ON
RXOTS-11-2-1 CONFIG 638 2 1 7911 SDCCH8 0 NO ON
RXOTS-11-2-2 CONFIG HOP 6 7 7586 TCH 0 NO ON
RXOTS-11-2-3 CONFIG HOP 6 6 7581 TCH 0 NO ON
RXOTS-11-2-4 CONFIG HOP 6 5 7610 TCH 0 NO ON
RXOTS-11-2-5 CONFIG HOP 6 4 7594 TCH 0 NO ON
RXOTS-11-2-6 CONFIG HOP 6 3 7647 TCH 0 NO ON
RXOTS-11-2-7 CONFIG HOP 6 2 7631 TCH 0 NO ON
RXOTS-11-4-0 CONFIG 629 1 7 7512 TCH 3 NO ON
RXOTS-11-4-1 CONFIG 629 1 6 7525 TCH 3 NO ON
RXOTS-11-4-2 CONFIG 629 1 5 7522 TCH 3 NO ON
RXOTS-11-4-3 CONFIG 629 1 4 7518 TCH 3 NO ON
RXOTS-11-4-4 CONFIG 629 1 3 7530 TCH 3 NO ON
RXOTS-11-4-5 CONFIG 629 1 2 7534 TCH 3 NO ON
RXOTS-11-4-6 CONFIG HOP 3 1 7571 TCH 3 NO ON
RXOTS-11-4-7 CONFIG HOP 3 0 7579 TCH 3 NO ON
RXOTS-11-5-0 CONFIG HOP 3 7 7509 TCH 3 NO ON
RXOTS-11-5-1 CONFIG HOP 3 6 7513 TCH 3 NO ON
RXOTS-11-5-2 CONFIG HOP 3 5 7535 TCH 3 NO ON
RXOTS-11-5-3 CONFIG HOP 3 4 7539 TCH 3 NO ON
RXOTS-11-5-4 CONFIG HOP 3 3 7559 TCH 3 NO ON
RXOTS-11-5-5 CONFIG HOP 3 2 7555 TCH 3 NO ON
RXOTS-11-5-6 CONFIG HOP 4 1 7575 TCH 3 NO ON
RXOTS-11-5-7 CONFIG HOP 4 0 7598 TCH 3 NO ON
RXOTS-11-6-0 CONFIG 629 1 0 7950 BCCH 3 NO ON
RXOTS-11-6-1 CONFIG 629 1 1 7923 SDCCH8 3 NO ON
RXOTS-11-6-2 CONFIG HOP 4 7 7487 TCH 3 NO ON
RXOTS-11-6-3 CONFIG HOP 4 6 7524 TCH 3 NO ON
RXOTS-11-6-4 CONFIG HOP 4 5 7532 TCH 3 NO ON
RXOTS-11-6-5 CONFIG HOP 4 4 7543 TCH 3 NO ON
RXOTS-11-6-6 CONFIG HOP 4 3 7576 TCH 3 NO ON
RXOTS-11-6-7 CONFIG HOP 4 2 7563 TCH 3 NO ON
RXOTS-11-8-0 CONFIG 617 0 7 7908 TCH 6 NO ON
RXOTS-11-8-1 CONFIG 617 0 6 7483 TCH 6 NO ON
RXOTS-11-8-2 CONFIG 617 0 5 7531 TCH 6 NO ON
RXOTS-11-8-3 CONFIG 617 0 4 7523 TCH 6 NO ON
RXOTS-11-8-4 CONFIG 617 0 3 7515 TCH 6 NO ON
RXOTS-11-8-5 CONFIG 617 0 2 7504 TCH 6 NO ON
RXOTS-11-8-6 CONFIG HOP 7 1 7716 TCH 6 NO ON
RXOTS-11-8-7 CONFIG HOP 7 0 7729 TCH 6 NO ON
RXOTS-11-10-0 CONFIG 617 0 0 7956 BCCH 6 NO ON
RXOTS-11-10-1 CONFIG 617 0 1 7931 SDCCH8 6 NO ON
RXOTS-11-10-2 CONFIG HOP 7 7 7657 TCH 6 NO ON
RXOTS-11-10-3 CONFIG HOP 7 6 7665 TCH 6 NO ON
RXOTS-11-10-4 CONFIG HOP 7 5 7673 TCH 6 NO ON
RXOTS-11-10-5 CONFIG HOP 7 4 7695 TCH 6 NO ON
RXOTS-11-10-6 CONFIG HOP 7 3 7704 TCH 6 NO ON
RXOTS-11-10-7 CONFIG HOP 7 2 7719 TCH 6 NO ON

MO RESULT ARFCN TXAD BSPWR C0F MISMATCH
RXOTX-11-0 CONFIG 638 2 45 YES NONE
RXOTX-11-1 CONFIG HOP 5 45 NO NONE
RXOTX-11-2 CONFIG HOP 6 45 NO NONE
RXOTX-11-4 CONFIG 629 1 45 YES NONE
RXOTX-11-5 CONFIG HOP 3 45 NO NONE
RXOTX-11-6 CONFIG HOP 4 45 NO NONE
RXOTX-11-8 CONFIG 617 0 45 YES NONE
RXOTX-11-10 CONFIG HOP 7 45 NO NONE

END

<RXAPP:MO=RXOTG-11;


RADIO X-CEIVER ADMINISTRATION
ABIS PATH STATUS

MO
RXOTG-11

DEV DCP APUSAGE APSTATE TEI
RBLT24-264 1 UNDEF IDLE
RBLT24-265 2 UNDEF IDLE
RBLT24-266 3 UNDEF IDLE
RBLT24-267 4 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX32 IDLE
RBLT24-268 5 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-269 6 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-270 7 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-271 8 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-272 9 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-273 10 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-274 11 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-275 12 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-276 13 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-277 14 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-278 15 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-279 16 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-280 17 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-281 18 MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
MPLEX16 SPEECH/DATA
RBLT24-282 19 CONC TRXC SIGNALLING 0 6 8 10
RBLT24-283 20 CONC CF AND TRXC SIGNALLING 62 1 2 4 5
RBLT24-284 21 UNDEF IDLE
RBLT24-285 22 UNDEF IDLE
RBLT24-286 23 UNDEF IDLE
RBLT24-287 24 UNDEF IDLE

END

<RXMOP:MO=RXOCF-11;


RADIO X-CEIVER ADMINISTRATION
MANAGED OBJECT DATA

MO TEI SWVERREPL SWVERACT SIG
RXOCF-11 62 DEFAULT B0531R0702 CONC

BSSWANTED NEGSTATUS
80 SUCCESSFUL

END


 
Try this.

{
if (FNR == 1) {
if (NR>1) {
for(j=0;j<num;j++) print &quot;RXOTRX-&quot; substr(a[j],7) > fn
b = substr(a[0],7,2)
print &quot;RXOTRX-&quot; b > fn
print &quot;RXOCON-&quot; b > fn
print &quot;RXODP-&quot; b > fn
print &quot;RXOIS-&quot; b > fn
print &quot;RXOTF-&quot; b > fn
print &quot;RXOCF-&quot; b > fn
print &quot;RXOTG-&quot; b > fn
close(fn)
}
num = n2 = 0
fnix++
fn = &quot;block_obj_&quot; fnix
}
if ($1 ~ /^RXOTS/) {print $1 > fn}
if ($1 ~ /^RXORX/) {a2[n2++] = $1}
if ($1 ~ /^RXOTX/) {
for (j=0;j<n2;j++) print a2[j] > fn
n2 = 0
a[num] = $1; num++; print $1 > fn
}
}
END {
for(j=0;j<num;j++) print &quot;RXOTRX-&quot; substr(a[j],7) > fn
b = substr(a[0],7,2)
print &quot;RXOTRX-&quot; b > fn
print &quot;RXOCON-&quot; b > fn
print &quot;RXODP-&quot; b > fn
print &quot;RXOIS-&quot; b > fn
print &quot;RXOTF-&quot; b > fn
print &quot;RXOCF-&quot; b > fn
print &quot;RXOTG-&quot; b > fn
} CaKiwi
 
CaKiwi is the KING! It works great! It puts the TS before the RX now!!!!!!!!!

Thank you so much!

It is still however creating one single TRX-11 see below:

RXOTRX-16-10
RXOTRX-16

It should not create a single one. In your previous post you corrected it, but I dont know how.
 
Remove the line

print &quot;RXOTRX-&quot; b > fn

after the line

b = substr(a[0],7,2)

(in 2 places)
CaKiwi
 
THAT WAS IT! IT WORKS ABSOLUTLY PERFECT NOW!

CaKiwi, thank you so much. Wish you were around, so I could buy you a pint!

Till next time, Beaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top