Hi,
I trying to find a bug in the code below:
FILE:
A00|1|1|1|1|1|1|1|FI|0
A01|0|1|1
FPV|1
FPV|2
FPV|3
FSV|1
FPT|2
HNH|0
AWK:
BEGIN {FS="|"}
{
if ( $1=="A00" ){
if ( $9=="FI" ) {
getline
if ( $1=="A01" ) {getline; printf "A01 " FNR "\n"} else {printf "problem: " FNR "\n"; exit}
if ( $1=="FPV" ) {
printf "poszlo w FPV \n";
while ($1!="FSV") {
if ( $1=="FPV" ) { getline; printf "poszlo w FPV2 " FNR "\n" ; }
else {printf "problem: " FNR $1"\n"; exit}}
}
if ( $1=="FSV" ) {prinft FNR " RR \n"; }
else {printf "problem: " FNR $1"\n";}
printf FNR " wiersz odczytany " $1 "\n"
}
else printf "problem: " FNR "\n"
}
}
END {}
when awk left the while loop then something goes wrong.
THX 4 help!
Cynki
I trying to find a bug in the code below:
FILE:
A00|1|1|1|1|1|1|1|FI|0
A01|0|1|1
FPV|1
FPV|2
FPV|3
FSV|1
FPT|2
HNH|0
AWK:
BEGIN {FS="|"}
{
if ( $1=="A00" ){
if ( $9=="FI" ) {
getline
if ( $1=="A01" ) {getline; printf "A01 " FNR "\n"} else {printf "problem: " FNR "\n"; exit}
if ( $1=="FPV" ) {
printf "poszlo w FPV \n";
while ($1!="FSV") {
if ( $1=="FPV" ) { getline; printf "poszlo w FPV2 " FNR "\n" ; }
else {printf "problem: " FNR $1"\n"; exit}}
}
if ( $1=="FSV" ) {prinft FNR " RR \n"; }
else {printf "problem: " FNR $1"\n";}
printf FNR " wiersz odczytany " $1 "\n"
}
else printf "problem: " FNR "\n"
}
}
END {}
when awk left the while loop then something goes wrong.
THX 4 help!
Cynki