I'm sorry to take your time with my questions. Unfortunately I am not an expert with awk but I'm slowly learning.
I am very grateful for the help that you and others profecionales working in this forum.
I learned a lot with the answers that have done me to questions. I have problems to understand how works the arrays.
Here is the script that I'm doing. At the end of this scrip that you can find the operation to capture status with the lines 14 and 98 but not especificimente as requested previpusly.
thanks for your help
#!/bin/csh
# C-shell script file.
set filename = `echo $1`
awk '{if(/^A/)print $0}' $1 | awk '{\
line = substr($0,1,128);\
ln =substr($2,1,5);\
vp =substr($3,1,5);\
ind =substr($3,8,1);\
printf("%-128s %5d%5d%1d\n", line,ln,vp,ind)}' > eff
#------------------------------------------------------------------------------------------------
# Compute the swath number ----------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
awk '{\
line = substr($0,1,141);\
sw = (int((substr($2,1,5)-'$CSWN')/12)) ;\
printf ("%-142s %3d\n",line,sw)\
}' eff > eff1
set first_sw = `awk '{sw = substr($0,144,4) ; printf("%4s\n", sw)}' eff1 | sort -nru | head -1`
# Replace second swath - low side - swath number for high side
awk '{\
sw = substr($0,144,4) ;\
dif = '$first_sw' - sw;\
if ( dif < 17) {\
line = substr($0,1,140);\
sw = sw - 18 ;\
printf ("%-142s %3d\n",line,sw)\
} else {\
print $0\
}\
}' eff1 > eff2
#------------------------------------------------------------------------------------------------
# sort vps by line and vp & index ---------------------------------------------------------------
#------------------------------------------------------------------------------------------------
cat eff2 | awk '{\
lvp =substr($0,130,11);\
ln =substr($2,1,7);\
vp =substr($3,1,7);\
ind =substr($3,8,1);\
sw =substr($0,144,4);\
x =substr($0,57,8);\
y =substr($0,66,9);\
tm =substr($0,119,8);\
st =substr($0,91,2);\
printf("%11d %5.1f %5.1f%1d %8.1f %9.1f %2d %8d %4d %5d%5d \n", lvp,ln,vp,ind,x,y,st,tm,sw,ln,vp)}' | sort -nk1 > eff3
#------------------------------------------------------------------------------------------------
# To get XY average for vp --------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
#awk ' {A = substr ($0,119,8); B = substr ($0, 57, 8); C = substr ($0, 66, 9)}\
# A != OA && NR > 1 {printf "%s%8.1f %9.1f%s\n", substr(D,1,56), SUM1/CNT, SUM2/CNT, substr(D,75); CNT=0; SUM1=SUM2=""}\
# END {printf "%s%8.1f %9.1f%s\n", substr(D,1,56), SUM1/CNT, SUM2/CNT, substr(D,75); CNT=0; SUM1=SUM2=""}\
# {OA = A; D=$0; SUM1+=B; SUM2+=C; CNT++}\
# ' eff
awk ' {A = substr ($0,52,8); B = substr ($0, 30, 8); C = substr ($0, 39, 9)}\
A != OA && NR > 1 {printf "%s%8.1f %9.1f%s\n", substr(D,1,29), SUM1/CNT, SUM2/CNT, substr(D,48); CNT=0; SUM1=SUM2=""}\
END {printf "%s%8.1f %9.1f%s\n", substr(D,1,29), SUM1/CNT, SUM2/CNT, substr(D,48); CNT=0; SUM1=SUM2=""}\
{OA = A; D=$0; SUM1+=B; SUM2+=C; CNT++}\
' eff3 > eff4
cat eff4 | sort -nk9 | awk '{if (x[$9]) {x_count[$9]++; print $0; if ( x_count[$9] == 1 ) {print x[$9]}} x[$9] =$0}' | sort -nk1 > eff5
cat eff5 | awk '{a = substr($0,13,16); print a}' > eff6
##o get all vps reshoted
grep -hFf eff6 eff2 | sort -k1.130,140bn > eff7
grep -vFf eff6 eff2 | sort -k1.130,140bn > eff8
#get bad VPS with wrong status not reshoted
cat eff8 | awk '{if(substr($0,91,2) == 14) print $0; else if(substr($0,91,2) == 98) print $0}'
#rm -f *tmp* *eff*