[SOLVED]Printing indexOf line
Please could anyone help me to find a better way to print a specific line in the text.
For instance, I have a Router interface configuration:
service-policy input QOS_IN
service-policy output QOS_OUT
ipv4 address X.X.X.X 255.255.255.252
encapsulation dot1q 200
Using indexOf function, I know that some line is configured, now I need to print a specif line (service-policy output QOS_OUT).
How can I do that?
Thanks in advance
[SOLVED] Printing indexOf line
I got a solution, I don't know if it is the best one.
String  linha1 = result.split("\n"); //break the text in lines
for (int i=0;i<linha1.length;i++)
if(linha1[i].indexOf("service-policy") != -1) //Read each line looking for this string
String  linha2 = linha1[i].split(" "); //If found, break line in spaces
print ("QoS "+linha2+" Configurado: "+linha2); //print the specific fields
It works fine, if someone have a better solution please let me know