in reply to Convert binary to ascii while sftp using Net::SSH2
... $ssh2 -> scp_put("${datafile}IMSI_SICAP.lst","/timesten/IMSI_SICAP.lst +")or die ("Error"); $ssh2->channel->exec("dos2unix /timesten/IMSI_SICAP.lst");
Another option is to use Net::SFTP::Foreign that supports the dos2unix operation natively:
use Net::SFTP::Foreign; my $sftp = Net::SFTP::Foreign->new($host, backend => 'Net_SSH2', username => 'user', password => 'aaa'); $sftp->error and die "Unable to connect: " . $ssh->error; $sftp->put("${datafile}IMSI_SICAP.lst","/timesten/IMSI_SICAP.lst", con +version => 'dos2unix');
|
|---|