I have a script bash to add users from a .txt file. It is really simple:
name firstname uid gid
space separated values
I want to check
Subtle changes to your script would do
result=$(awk -F' ' 'BEGIN{flag=1}NF!=4{flag=0;exit}END{print flag}' "$file")
[ ${result:-0} -eq 0 ] && echo "Problematic entries found in file"
The approach
exit
would skip the rest of the input and go to the END
rule.