Using awk for such a purpose is like using H-bombs for chasing blackbirds away.
As i take it from your explanation of the problem you want to find the line containing "Processes completed, XX errors found" where XX could be any number. Then you want to get this value of XX into a variable for further processing.
I suppose here for the sake of simplicity that the file cannot contain more than one line with "Processes completed....". If this would be the case the solution would need a loop to process one value after the other. Pls. check back if this is the case and I'll expand on this. Here we go:
We want to find a line that contains "Processes completed,", then some integer value, followed by " errors found". We want to ignore all the other lines in the file and reduce this line to only the integer value. This is the basis of our regular expression:
sed -n 's/^Processes completed, \([0-9][0-9]*\) errors found/\1/p' taic.log
The '-n'-option tells sed not to print any lines until explicitly being told so by the "p" option. Now we have phrased our substitute-expression in a way, where only the one line we look for fits in, so this is the only one which will get printed. within the line we define a variable ("\(....\)") and in it we catch every number there might be. We replace the comlete line by only the numbers in this variable ( .../\1/....) and hence print only them to stdout.
The next part is to catch this output into a shell variable. We do this by issuing the sed-command in a subshell:
iErrors=$(sed -n 's/^Processes completed, \([0-9][0-9]*\) errors found/\1/p' taic.log)
Now the shell fires up a new shell, executes in this everything between "$(" and ")" and replaces the "$(...)" with the output of that command. This is our integer and after doing this the command really to be executed would be (in case the errors would be 10) "iErrors=10". Now the only task left is to tidy up by declaring all the involved variables. Taken them for granted is *yuck*, y'know? ;-))
#! /bin/ksh
typeset -i iErrors=$(sed -n 's/^Processes completed, \([0-9][0-9]*\) errors found/\1/p' taic.log)
if [ $iErrors -eq 0 ] ; then
# 0 errors found
elseif [ $iErrors -eq 1 ] ; then
# 1 errors found
else
# more than 1 errors fould
fi
....
I hope this helps.
bakunin