I have a Java application using SSH connection, remote execution of CLI commands. For a specific command, I would like to pass the output of the command through two regular expressions, I find two correlated subsets of the general output and return them back to my program.
For each of the two regular expressions: < RE1 > and < RE2 >, I would like to format the resulting outputs: < RE1out > and < RE2out via < action1 > and < action2 >, respectively; then return the final result, for example (please excuse the pseudo-shell script):
<command> | grep -e <RE1> -e <RE2> | (<REout1> given to <action1> and <REout2> given to <action2>) yields <final_output>
source
share