You can use Net :: SSH :: Perl . Below is an example of code that you can use.
#!/usr/bin/perl -w use strict; use Net::SSH::Perl my $cmd = 'command'; my $ssh = Net::SSH::Perl->new("hostname", debug=>0); $ssh->login("username","password"); my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd"); print $stdout;
This code will simply run the given βcommandβ on the remote computer and give you the result on your local system. So, instead of scp, you can use this script with the "cat" command to capture the output of "cat filename" on the local system and redirect the output to a file on the local system.
Hope this helps.
Space source share