Extract data from file, save them in variables then call the data to function

PLEASE HELP
Hello everyone,, Im reading distance>10 from ultrasonic sensor, save them in a file with timestamp, in every 24hrs I want to call and save the data in variables for analysis in a function

Qn: I want to call every sensor data (distance) from file and put them in ranges ie (50-80, 110-140)cm, then finally count how many classes of data I have. e.g considering data below I have two classes of data

my file data is as follows

hr:min:sec dt:mn:yr= sensor data(distance)
17:22:51-14/8/2020= 57cm
17:22:52-14/8/2020= 119cm
17:22:53-14/8/2020= 70cm
17:22:55-14/8/2020= 114cm

Thanks for your patience, Eddy

Here is my code 

#include <SPI.h>
#include <SD.h>
#define trigPin 3 
#define echoPin 2
#include <RF24.h>
#include <DS1307RTC.h>
#include <Time.h>
#include <Wire.h>
int counter = 0;  
long distance;
long duration; 


const int chipSelect = 10;
File myFile;
String time ;
tmElements_t tm;


void setup() { 
 Serial.begin(9600); 
 pinMode(trigPin, OUTPUT); 
 pinMode(echoPin, INPUT); 

 Serial.println("ArduinoAll DataLogger Shield Test");
 pinMode(SS, OUTPUT);

 if (!SD.begin(chipSelect)) {
   Serial.println("SD Card initialization failed!");
   return;
 }
 Serial.println("SD Card OK.");
 //ReadText();
} 

void WriteText(String txt) {
 myFile = SD.open("test.txt", FILE_WRITE);
 if (myFile) {
   myFile.println(txt);
   myFile.close();
 }
 else {
   // if the file didn't open, print an error:
   Serial.println("error opening test.txt");
 }
}


long readUltrasonicSensor(){ 
 // Send 10µs pulse 
 digitalWrite(trigPin, HIGH); 
 delayMicroseconds(10); 
 digitalWrite(trigPin, LOW); 
 // Read pulse duration 
 duration = pulseIn(echoPin, HIGH); 
// Serial.println(duration); //Convert and return value 
 return duration/ 58; 
}

String Now() {
 String time = "";
 if (RTC.read(tm)) {
   //    time = String(tm.Hour+":"+tm.Minute+":"+tm.Secnd+" DAY : "+tm.Day+"/"+tm.Month+"/"+tmYearToCalendar(tm.Year));
   time += tm.Hour;
   time += ":";

   time += tm.Minute;
   time += ":";

   time += tm.Second;
   time += "-";

   time += tm.Day;
   time += "/";

   time += tm.Month;
   time += "/";

   time += tmYearToCalendar(tm.Year);
 }
 else {
   time = "NO";
   if (RTC.chipPresent()) {
     Serial.println("The DS1307 is stopped.  Please run the SetTime");
     Serial.println("example to initialize the time and begin running.");
     //Serial.println();
   }
   else {
     Serial.println("DS1307 read error!  Please check the circuitry.");
     //Serial.println();
   }
 }
 return time;
}


void analysis(){
myFile = SD.open("test.txt");
if (myFile) {
  Serial.println("tet.txxt:");

char buffer[50]; // May need to be a bit bigger if you have long names
byte index = 0; 


while (myFile.available())
  {
     char c = myFile.read();
      if(c == '\n' || c == '\r') // Test for <cr> and <lf>
      {
          parseAndSave(buffer);
          index = 0;
          buffer[index] = '\0'; // Keep buffer NULL terminated
      }
      else
      {
          buffer[index++] = c;
          buffer[index] = '\0'; // Keep buffer NULL terminated
      }
   
  }
  myFile.close();
}
else {
  Serial.println("error opening test.txt"); 
}
  
}

void loop()
{
distance=readUltrasonicSensor();
 
  if ( distance > 10 )
 {
time = Now() + "= "+distance;
 WriteText(time);
 delay(1000);
 
}}

void parseAndSave(char *buff)
{
  char *name = strtok(buff, "=");
  if(name)
  {
      char *junk = strtok(NULL, " ");
      if(junk)
      {
          char *valu = strtok(NULL, " ");
          if(valu)
          {
              int val = atoi(valu);
              if(strcmp(name, distance) == 0)
              {
                   int distance1 = val;
              }
          }
       }
    }
   
 }

What do you need help with?

It looks like you have functions for reading and parsing the data. All that remains is the counting into ranges which sounds simple enough.

Thanks wildbill for your time, Im a beginner to coding, can you show me with a code how I can count into ranges, thanks in advance
Eddy

(deleted)