tsandras has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Convert binary to ascii while sftp using Net::SSH2
by roboticus (Chancellor) on Mar 01, 2011 at 10:56 UTC | |
|
Re: Convert binary to ascii while sftp using Net::SSH2
by salva (Canon) on Mar 01, 2011 at 09:59 UTC | |
|
Re: Convert binary to ascii while sftp using Net::SSH2
by jethro (Monsignor) on Mar 01, 2011 at 09:54 UTC | |
|
Re: Convert binary to ascii while sftp using Net::SSH2
by 0xbeef (Hermit) on Mar 01, 2011 at 20:34 UTC | |
|
Re: Convert binary to ascii while sftp using Net::SSH2
by syphilis (Archbishop) on Mar 02, 2011 at 09:17 UTC | |
|
Re: Convert binary to ascii while sftp using Net::SSH2
by parkprimus (Sexton) on Mar 02, 2011 at 10:54 UTC |