On 3/16/06, Vidyadutt S vidyadutt_s@yahoo.com wrote:
FILE=$1 FIELDS=$2 cat $FILE | while read RECORD do if [ `printf "$RECORD" | awk -F| '{ print NF }'` -ne $FIELDS ]; then NM_CNT=`expr $NM_CNT + 1` printf "NM_CNT=$NM_CNT\n" fi done printf "NM_CNT=$NM_CNT\n" return $NM_CNT
I am a novice at programming but so don't flame me if I am wrong but the problem can be with the line marked in bold. Shouldn't you be returning NM-CNT instead of $NM_CNT?