use Control::CLI;
$cli = new Control::CLI('SSH');
$cli->connect(Host=>'10.10.10.10',Username=>'user',Password=>'pwd');
$cli->waitfor('>');
$cli->print('Show XXXXXXXXXXXXXXXXXXXX| grep Active');
@f=$cli->waitfor('>');
print @f;
$cli->disconnect;
The above code give me output as:
Show XXXXXXXXXXXXXXXXXXXX| grep Active
Active
Sunday January 29 00:40:34 IST 2012
Active : 1106 Dormant : 0
[local]NOI-S57-XYXYX>
But I want to capture only “1106”( in the 3rd line, value between Active: “1106” and Dormant), Please help!!
Thanks in advance!!
The following code worked for me: