returning from Net::Telnet cmd

J

justme

hi

i have a question regarding the usage of Net::Telnet cmd.
here is some of my code
use Net::Telnet;
$key = <STDIN>;
$dir = '/home';
chomp($key);
my $telnet = Net::Telnet-> new
( Timeout => 30,
Prompt=>'server#'
);
$telnet->open("$telnetserver");
$telnet->
login($login,$pass);
my @listing = $telnet-> cmd("cd $dir;/usr/bin/grep '$key' *");
$telnet->close;
print "@listing\n";

here is my situation. in $dir, there are many text files, as much as
8000 files.
and i need to grep for $key in every file. sometimes i can get the
results
if the grep results is small. Otherwise, no results will be output if
the grep is big.
Anyway i can work around this or is there something i miss in the
code?. Is it better print to screen as the cmd executes using a while
loop? any suggestions is greatly appreciated thanks..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top