I have a file (tnsnames.ora in Oracle) from which i have to extract the values of two fields. Suppose following is the content of my file called "inputfile.txt"
(ADDRESS = ( PROTOCOL = TCP ) ( HOST = 1.1 ) ( PORT = 1521 ))
(ADDRESS = ( PROTOCOL = TCP ) ( HOST = 3.1 ) ( PORT = 1521 ))
I want to extract the value of HOST from this file and assin it to an array. For eg. from the above file, i need to get the HOST values and store in the array like
That is i want to extract just the values of HOST from all the lines in the file given. Remember the format is the same but there are spaces in the first and third row but not in the second row. Any help would be greatly appreciated.