Count the decimal numbers with 6 precision

Hi guys,

I have a single column file with millions of records. I want to count the number of records with 6 decimal precision.

for ex:

1234.12
1234.132
12345.12345
1234.1
1234.13
1234.123456
243435.454555

i need to count the number of records with precision of 6 ( i.e here the count is 2)

Any kind of help is appreciated

THanks!
Marcus

nawk -F. '{if (length($2)==6) s++}END{print s}'  myFile
1 Like

Thanks! vgersh99, i will try that out and will let you know about the result.

Thanks!

grep -c '\.[0-9]\{6\} *$' infile

(g)awk

awk -F. 'length($2)==6{t++}END{print t}' file
1 Like