Reading data from SD Card and checking it.

Hello to all, thanks for reading my post.

I have a problem.

My SD card format its like:

322344
987232
122324
323981
444226

My problem: I got 322344 value from a sensor, if it exists on sd file, turn the green led ON, if not turn the red led ON etc.
The led things its easy, I made this code:

  if (var == datasd)
  {
  digitalWrite(led2, HIGH);
  digitalWrite(led1, LOW);
  }
  else {
  digitalWrite(led2, LOW);
  digitalWrite(led1, HIGH);

  }

"var" its the number that I got from the sensor and "datasd" its the int from the SD file, now my problem its, how to check if the value exists in one line on the file, to do the if.
How i can check like grep in bash here?

Im using SD library to read like this:

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

    while (myFile.available()) {
      Serial.write(myFile.read());

    }

Help me please!
Sorry for my bad english. <3

Just to give you the idea, below should read one line at a time and print it.

char buffer [20];
while (myFile.available())
{
      myFile.readBytesUntil ('\n',buffer,19);
      Serial.print(buffer);
}

The buffer variable should be big enough to hold all digits for the longest number.

You can use strcmp() to compare with another text.

P.S.
Can't test.