Forum Discussion
David_Bond
2 months agoProfessor
If you echo "---------------------------" before and after the file, you can use split and pull out the 1th element (zero-indexed).
Example:
import com.santaba.agent.groovyapi.expect.Expect;
host = hostProps.get("system.hostname");
user = hostProps.get("test.user");
pass = hostProps.get("test.pass");
cli=Expect.open(host, user, pass);
cli.send("echo \"----------------------------------------\"\n");
cli.send("cat test.conf\n");
cli.send("echo \"---------------------------------------END\"\n");
cli.expect('---END');
config=cli.before();
println config.split('---------------------------------------')[1];
Related Content
- 9 months ago
- 10 days ago