Currently I'm utilising Net::SSH2 perl script to sftp file from Windows to Unix server. However, after transering the file, the file is having an extra character (^M) at the end of each line as the sample below.
0146669944 502126920956715 1^M 0146456870 502124950748150 1^M 0142811862 502122912649310 1^M
Is this due to the file format that's being transferred is in binary format and not in ASCII? If this is the case how do i incorporate the change of the file type from binary to ascii within the script below?
use warnings; use strict; use Net::SSH2; my $datafile = "D:/ETL/RPT/MD/IMSI_SICAP.lst"; my $ssh2 = Net::SSH2->new; $ssh2 -> connect("192.100.100.238") or die ("Error"); $ssh2 -> auth(username => 'user', password => 'aaa') or die ("Error"); $ssh2 -> blocking(1); $ssh2 -> scp_put("${datafile}IMSI_SICAP.lst","/timesten/IMSI_SICAP.lst +")or die ("Error"); $ssh2 -> disconnect();
Would really appreciate some guidance on this. Thanks.
In reply to Convert binary to ascii while sftp using Net::SSH2 by tsandras
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |