how to count the numerical digits in between the text using a command or a script?
hi dear all,
i want to count the digits in between the text in a file. e.g. write down the form 2.3 3.3 3.0 505.0 0.777E07 22.3 3.3 5.0 503.0 1.777E04 then read this. how can i do the counting of these digits present in between a text in a file? with regards kilam 
what should your total count be? explain in detail how you are counting the digits. Homework?

Quote:
i just want to count the number of points.Also these points are arranged horizontally like given below: 0.135079299943E03 0.137325385988E03 0.139599724318E03 0.141902670302E03 0.144234583780E03 0.146595829119E03 0.148986775268E03 0.151407795817E03 and so on. hope i explained well. with regards kilam 
From what you have supplied, it sounds like you want to count NUMBERS and not digits. Each number you show is in scientific notation, which includes a character.
Please clarify exactly what you need to countfor example, in the post above, there are 8 numbers, each with 12 significant digits + a 2digit exponent. Since the leading digit is always 0, I do not count it as significant. 
Quote:
I expect he could easily do this by counting the total number of occurrences of the letter E as each number has only one E. Or use tr to convert all the spaces to newlines, grep to filter out blank lines, then just count the number of lines in the file? Here's an interesting link: http://www.linuxjournal.com/article/10359 [Edit] It's even easier than that: The numbers are alphanumeric strings, separated by whitespace. So they count as "words" which can be counted by wc So to count the number of numbers all you need is wc w filename [/Edit] 
Quote:
sorry i didn't tell that my file contains numbers along with the numbers in scientific notation. i.e. 0.968629524999E01 0.980905826664E01 0.993336540375E01 0.100592360821 0.101866899668 so, counting the number of E's works fine using wc command, but how to count both types of numbers? with regards, kilam 
You could count the occurences of the following Regex:
Code:
0\.[09]{5}[09]*[^09] 
Like I said in my edit  you don't need to count the number of Es. The problem is trivial.
Just use wc w filename You could test this by copying a small part of your file to another file, manually counting the numbers, then wc w testfile 
Code:
$ more file 
Quote:

All times are GMT 5. The time now is 11:59 AM. 