in reply to Searching in remote files over SSH

Are the files small? If so, I'd try loading them into memory before your loop through File1 - especially if you're going to do repeated searches:

my @file21 = `ssh host2-1 "cat File2-1"`; my @file22 = `ssh host2-2 "cat File2-2"`;
Then you can use the grep internal function to look for what you want.

(This is one of the few times I would use the backticks for running programs...)

Replies are listed 'Best First'.
Re^2: Searching in remote files over SSH
by sitnalta (Initiate) on Nov 21, 2006 at 22:14 UTC
    The files are rather large from 30 - 500 megs.

      30 meg? Bah, that's small. 500 meg? Meh, not small, but not large, either.

      However, if you're concerned, I would still copy the files locally, just to cut down on network transmission from repeated searches. If that's not something you want to do, you could create a perl script that did all the searches based on File1, and run that over ssh.

      Finally, you could just create a perl script that you put on to each server that you could interact with, and, using IPC::Open2, you could send it queries to do on the remote machine, and it would send replies back...

      TIMTOWTDI isn't just a perl maxim, it applies to all of unix ;-)