[Scilab-users] [EXTERNAL] Count specific values in text file
Samuel Gougeon
sgougeon at free.fr
Wed Feb 12 10:12:15 CET 2020
Le 12/02/2020 à 08:57, arctica1963 a écrit :
> Hello Philipp
>
> Your suggestion is kind of what I am trying to do, but the text file is not
> a CSV structure. It is just a single, very big number on one row. A small
> chunk:
>
> 31415926535897932384626433832795028841971693993751058209749445923078164 etc
> (no spaces between digits)
>
> How best to load the text file and then count the number of occurrences of a
> specific digit (e.g. 1)? At the moment the file essentially contains a very
> big integer.
--> t =
"31415926535897932384626433832795028841971693993751058209749445923078164";
--> length(regexp(t,"/1/"))
ans =
6.
--> length(regexp(t,"/41/"))
ans =
2.
More information about the users
mailing list