How to screen each variable record for right # of fields

Hi,
In a script I have to check that input text files with a variable number of tab delimited fields have at least n fields and no more than m fields. Records are delimited by <CR> and <LF>.

I have figured out code that will strip out all the alpha-numeric characters, convert the tabs to hyphens and then with each record consisting of only hyphens, I could pipe the output to awk to make sure that for each line the number of hyphens was correct as follows:

cat ${FILENAME} | tr '[:print:]' '[\0*]' | tr '[\t]' '[-]' | awk '/-{3,6}/'

The first part, cat ${FILENAME} | tr '[:print:]' '[\0*]' | tr '[\t]' '[-]' , seems to work, producing the following output, which is correct:
----------
--
----
-----
----------
----------
----------
Once I pipe this into awk though, I get no output at all, so not sure what I'm doing wrong. Please help - thanks!! -j

Are these file DOS (Windows) files? dos2ux or dos2unix (check your manpage)
will take care of that problem:

dos2unix $filename |
awk -F"\t" {
                   if(NF>6 || NF<3)
                   {
                          print "bad line ", $0
                    }
              } '  

Thanks much for the code suggestion - this looks totally straightforward though I'm having trouble getting it to work. I also tried several variations of it, omitting curly brackets and the 'if' - none work - not sure what I'm doing wrong.
Here's the latest version. It seems to partially work as follows (omitted the 'if' and outer curly brackets - not sure if that's the right thing to do). When is the 'if' needed and when is it not ???
awk -F"\t" ' (NF >= 6 || NF <= 3)
{
print NF $1 $2 $3
} ' < ${FILENAME}

The problem is that the code outputs every record in the file (plus some extra output lines) with the filter criteria determining what is printed: the output is right for lines/records that meet the filter criteria. For records in which NF does not meet the criteria, this prints out the whole record, not just NF $1 $2 $3.

Here's the original test file data and the output from code above:
101 111111 N
245 22 N STRING1
333 373323 N STRING1 STRINGSTRING2 A3 C3
189 64399 Y STRING1 STRINGSTRING2 A5 B0 C9 E4
555 7 N STRING1 STRINGSTRING2

Output:
101 111111 N
6101111111N
524522N
333 373323 N STRING1 STRINGSTRING2 A3 C3
10333373323N
189 64399 Y STRING1 STRINGSTRING2 A5 B0 C9 E4
918964399Y
55557N

Thanks for any and all help! -j

Got it to work using basically your original code:

awk -F"\t" ' { if (NF >= 6 || NF <= 3)
{
print NF "--" $1 $2 $3
}
} ' ${FILENAME}

THANKS!