How to read particular value from file?

Lets say my file has few lines.
Mango=6
Apple=5 Grape=4

I know how to read line by line
But don’t know how to read value of Grape where ever it may be inside the file.
Can anyone help me?

In reply to Adarsh Santhosh:
Some tools have added built-in string methods like as show below. If not, a number of other libraries packages like UVM and SVunit.

module top;
   string str;
   int FILE;
   initial begin
      FILE=$fopen("fscanf.txt","r");
      while($fscanf(FILE,"%s",str) == 1)
	 if(str.match("([a-zA-Z]+)=([0-9]+)"))
	    $display("name: %s value: %d",str.backref(0), str.backref(1));
   end 	    
endmodule : top

In reply to dave_59:

Im using questasim
i think it doesnt have backref and match optons for string.

its showing the below text

Field/method name (match) not in ‘str’
** Error: example.sv(17): Field/method name (backref) not in ‘str’

In reply to Adarsh Santhosh:

Unless get a later version, you’ll have to search for a DPI package that does this for you, or write the code yourself. The UVN package has this, and even if you do not have a UVM testbench, you can still import the package and use the routines there.

In reply to dave_59:

Can I somehow search for a particular string in a file?

In reply to dave_59:

Or can u point me to somewhere I can learn more about file operations like $fopen ,$fscanf etc ?

In reply to Adarsh Santhosh:

https://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=8299593

SystemVerilog is not a text processing language.