#Records that have more than 8 fields BEGIN { FS="," ; MaxFields=11 #Number of fields in Records errCnt=0 #Records with Errors errRec="These Records have Errors:" echo "PHP = $PHP" if ( $PHP == 1) { printf("\n"); printf("\n \n"); #printf("\n"); #printf("\n \n"); printf("\n

Check Fields of Data file

\n"); } } { #first record is header if (NR == 1) { lineNum=0; #Skip first line since title of columns if ( $PHP == 1) { printf("

Info: Number of Fields Required=%s\n
Number of Records Found=%s\n

", NF, NR) } printf("\n"); printf("\n"); #Create Select Row Column printf("" for (f=1; f <= MaxFields ;f++) { if (f < 6 ) printf("\n\n"); #Goto next record after printing title for table/template of fields next } else { tableValBegin="" } lineNum += 1; #LineNum Count #look thru fields for (f=0; f <= NF; f++) { if (f == 0 ) { #Create Check Box to select row printf("\n", lineNum, lineNum); } else if (f == 1 ) { if (NF != MaxFields) { errRec = errRec "
" NR ": NF=" NF "=" $0 errCnt = errCnt + 1 printf("\n%s

ERROR:

%s%s
", tableValBegin, $1, tableValEnd); } else printf("%s%s%s", tableValBegin, $1, tableValEnd); #printf("\n%s%s%s", tableValBegin, $1, tableValEnd); } else { if (f < 6 ) printf("%s%s%s\n", tableValBegin,$f, tableValEnd) ; else if (f == NF) printf("%s%s%s", tableValBeginID, $f, tableValEnd); else printf("%s%s%s\n", tableValBeginID,$f, tableValEnd) ; } } #Stop after x number of Records #Only process this many records if (NR == 800) exit } END { print "\n
"); printf("\n
\n"); printf("Select:
\n"); printf("All: \n"); printf("
\n"); tableValBegin="
" tableValEnd="%s%s\n", f,f,$(f), tableValEnd) ; else printf("%s%s\n", f,$(f), tableValEnd) ; } printf("
" tableValBeginID="" tableValBegin1="" tableValBeginID1="" tableValEnd="
%s
\n" if (f != 1 && f != 9) { #printf("%s ", $f) ; ##{printf("%s%s%s%s\n\n", $1, $3, $4, $5)} } #else #printf("%s\n", f) if ( $PHP == 1) { printf("

Info:
Number of Fields Required=%s\n
Number of Records Found=%s\n

", NF, NR) if (errCnt > 0 ) printf("

ERRORS
Found=%s
%s\n

", errCnt, errRec); else printf("

No Errors Found!

"); print "\n\n" } }