Regex ssh2中的Perl Grep->;执行官什么也没找到

Regex ssh2中的Perl Grep->;执行官什么也没找到,regex,linux,perl,ssh,grep,Regex,Linux,Perl,Ssh,Grep,我设计了一个程序,在我的所有应用程序的不同Solaris(Unix)框中遍历每个日志文件并查找某个错误。因此,我设计了如下程序: my $ssh2 = Net::SSH2->new(); $ssh2->connect($host) or die "Unable to connect Host $@ \n"; $ssh2->auth_keyboard($user,$pass) or die "Unable to login $@ \n"; $chan1 = $ssh2->

我设计了一个程序,在我的所有应用程序的不同Solaris(Unix)框中遍历每个日志文件并查找某个错误。因此,我设计了如下程序:

my $ssh2 = Net::SSH2->new();
$ssh2->connect($host) or die "Unable to connect Host $@ \n";
$ssh2->auth_keyboard($user,$pass) or die "Unable to login $@ \n";

$chan1 = $ssh2->channel();
$chan1->exec("find /apps/appName/loc/Logs/server/ -type f | xargs grep \"CVS Call\" ");
while(<$chan1>) {
    print $_ . "\n";
}
我使用这个命令得到了相同的结果,works find只使用了一个单词,只要添加第二个单词,它就不会显示任何结果


有人知道为什么我在grep搜索中添加一个空格时,它什么也找不到

这个问题可能与所需报价的几个级别有关。用手做这件事很难

如果您使用的是Linux/Unix设备,您可以使用以下哪种设备为您报价:

 my $ssh = Net::OpenSSH->new($host, user => $user, password => $password);
 my @lines = $ssh->capture('find', $logs_dir,
                           '-type', 'f',
                           '-exec', 'grep', '-q', $string, '{}', ';',
                           '-print');

 for (@lines) {
     ...
 }
 my $ssh = Net::OpenSSH->new($host, user => $user, password => $password);
 my @lines = $ssh->capture('find', $logs_dir,
                           '-type', 'f',
                           '-exec', 'grep', '-q', $string, '{}', ';',
                           '-print');

 for (@lines) {
     ...
 }