I explain: I get a response string from a console of a switch. This is fine and it works. A command is executed that returns a table like this:
SwitchPrueba#show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation SecurityAction
(Count) (Count) (Count)
---------------------------------------------------------------------------
Fa0/1 2 1 0 Restrict
Fa0/2 1 0 0 Restrict
Fa0/3 1 0 **8** Restrict
Fa0/4 1 0 0 Restrict
Fa0/5 1 0 0 Restrict
Fa0/6 1 0 0 Restrict
Fa0/7 1 0 0 Restrict
Fa0/8 1 0 0 Restrict
Fa0/9 1 0 0 Restrict
Fa0/10 1 0 0 Restrict
Fa0/11 1 0 0 Restrict
Fa0/12 1 0 0 Restrict
Fa0/13 1 1 0 Restrict
Fa0/14 1 1 0 Restrict
Fa0/15 1 0 0 Restrict
Fa0/16 1 0 0 Restrict
Fa0/17 1 0 0 Restrict
Fa0/18 1 1 0 Restrict
Fa0/19 1 0 0 Restrict
Fa0/20 1 0 0 Restrict
SwitchPrueba#exit
Now the problem is coming. I need to execute another command that is executed depending on the SecurityViolation column where the command to execute is when the values of that column are greater than 0. Then the command would be something like this:
clear port-security dynamic interface Fa0 / 3
since it is the only one greater than 0
All that table I receive as a string. And I really do not know how to try to get line by line or column by column.
I do not put code because I do not have it. It would practically be something like this:
String respuesta = "SwitchPrueba#show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation SecurityAction
(Count) (Count) (Count)
---------------------------------------------------------------------------
Fa0/1 2 1 0 Restrict
Fa0/2 1 0 0 Restrict
Fa0/3 1 0 **8** Restrict
Fa0/4 1 0 0 Restrict
Fa0/5 1 0 0 Restrict
Fa0/6 1 0 0 Restrict
Fa0/7 1 0 0 Restrict
Fa0/8 1 0 0 Restrict
Fa0/9 1 0 0 Restrict
Fa0/10 1 0 0 Restrict
Fa0/11 1 0 0 Restrict
Fa0/12 1 0 0 Restrict
Fa0/13 1 1 0 Restrict
Fa0/14 1 1 0 Restrict
Fa0/15 1 0 0 Restrict
Fa0/16 1 0 0 Restrict
Fa0/17 1 0 0 Restrict
Fa0/18 1 1 0 Restrict
Fa0/19 1 0 0 Restrict
Fa0/20 1 0 0 Restrict
SwitchPrueba#exit"