How can i access a particular data from a file

e.g:
(filename: test.txt) contains data as follows

NAME John Smith
AGE 25
HEIGHT 170cm
WEIGHT 80kg


let say i want to acces NAME from that file that has data "John Smith" , how can i do it
anyone can help me