
January 17th, 2013, 12:14 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 5
Time spent in forums: 1 h 44 m 37 sec
Reputation Power: 0
|
|
|
Search Text File for String on Remote Computer
I'm trying to figure out how I can search for any occurance of a specific string in a text file on a remote computer. My OS is redhat 5. The following is a way, but not so sure it's the best way:
Code:
my $rc = `ssh -q machineName "cat /tmp/file.txt" | grep TextToSearch`;
if ($rc}
{
print "found your string";
}
else
{
print "no such string";
}
Any thoughts?
Thanks,
Eric
|