perl - Grepping the line from log file and based on that line printing the pass or fail -


i writing 1 perl script in have grep particular line or string or text log file present in remote machine connected using "expect" module perl script. and, if line present in file have print output pass or fail.

hope clear,

below code trying out:

$var1->send("grep expected sea*\n"); 

grepping "expected sea*" log file. how pass line or string variable , how print pass or fail.

send echo output pty, if trying capture output after command execution need use exp_after.

     example say:       $cmd = "your grep cmd";       $output;      [         qr"yourhostname",         sub {         $spawn_ok =1;         $val1 = shift;          $var1->send("$cmd; exit \n");         exp_continue;         }      ],      [        qr"expected sea*",  #you can match string         sub {             $val1 = shift;             $output = $val1->exp_after; #output of grep             exp_continue;             }       ],        print $output; # here can use $output parse , if condition can print yes or no 

this closed i've tried.. hope helps can check [cpan] (http://search.cpan.org/~rgiersig/expect-1.15/expect.pod "expect")


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -