in reply to Re: replace a line when regex match...
in thread replace a line when regex match...
But I am getting this error:#!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $rcmd = " perl -e 'use strict; open(FD, filetochange.txt) or die \"can n +ot open FD: $!\"; while (<FD>) { if (/mon/ && /messages/) { print $_; #change line here } } close(FD); '"; my $ssh = Net::SSH::Perl->new('localhost', protocol=>('2,1')); $ssh->login('joe1','blabla'); my($stdout, $stderr, $exit) = $ssh->cmd("$rcmd"); print $stdout;
Any idea? or does some one have a better idea of loging into a remote box and running an inline script on it? Thanks.Use of uninitialized value in concatenation (.) or string at ./hash_ms +gstab.pl line 6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: replace a line when regex match...
by revdiablo (Prior) on Apr 12, 2005 at 05:25 UTC |