Here is another file where the close statement is missing, I tried to add it at the bottom, but it did not work.
#---------Nawk12--------------
{
if (FNR==1) {
for (j=1;j<=11;j++) a[j] = 0
fn1 = FILENAME
sub(/[^0-9]*/,"",fn1)
fn2 = "pre_build_e" fn1
fn1 = "antennas_power_" fn1
print fn1
while ((getline s < fn1) > 0) {
print s
if (s ~ "RXOTX" {
split(s,f1)
split(f1[1],n1,"-"
a[n1[3]] = f1[6]
}
}
}
if ($0 ~ "RXOTX" {
split($0,f1,","
j = split(f1[1],n1,"-"
print j " " n1[1] " " n1[3] " " a[n1[3]]
if (a[n1[3]]) sub(/POWER/,a[n1[3]])
}
print > fn2
}
#---------Nawk12--------------
{
if (FNR==1) {
for (j=1;j<=11;j++) a[j] = 0
fn1 = FILENAME
sub(/[^0-9]*/,"",fn1)
fn2 = "pre_build_e" fn1
fn1 = "antennas_power_" fn1
print fn1
while ((getline s < fn1) > 0) {
print s
if (s ~ "RXOTX" {
split(s,f1)
split(f1[1],n1,"-"
a[n1[3]] = f1[6]
}
}
}
if ($0 ~ "RXOTX" {
split($0,f1,","
j = split(f1[1],n1,"-"
print j " " n1[1] " " n1[3] " " a[n1[3]]
if (a[n1[3]]) sub(/POWER/,a[n1[3]])
}
print > fn2
}