jimbus has asked for the wisdom of the Perl Monks concerning the following question:
Alright, here's another stupid one
When I use SMB to DL a CSV file there is something funky happening to the lines in the file. If I move the files with ftp they are fine (we had this discussion before: the source machine doesn't have an FTP server, but is mounted to our laptops, most people's laptops don't have an FTP server or perl, so I need to get the files from the source machine to the processing machine (a solaris 8 machine). I can ftp them using a client on the laptop then open telnet to run the script or use telnet to run the script and have the script do it with SMB).
Reading all the lines and printing them as such:
open(FILE, "+<", $filename) or die ($node_name."Could not open file: $filename"); @csvArray = <FILE>; foreach $csvLine (@csvArray) { if ($csvLine =~ /AMA/) { $csvHash{"header"} = $csvLine; next; } @fields = split /,/, $csvLine; @tmp = split /\./, @fields[2]; chomp($csvLine); $csvHash{@tmp[0]} = $csvLine; } @csvArray = sort values(%csvHash); foreach $mem (@csvArray) { print "LINE:$mem<\n"; } exit;
I get the results for FTP:
LINE:9/8/2005 0:00,FRDS,CDR-827705_9_08.FCDR_1.6718.FRDS.11328,1028217 +0,5020,40018,40018,0,0,0< LINE:9/8/2005 0:00,FRDS,CDR-827805_9_08.FCDR_1.6718.FRDS.11329,8837858 +,4315,34243,34243,0,0,0< LINE:9/8/2005 0:00,FRDS,CDR-827905_9_08.FCDR_1.6718.FRDS.11330,7652257 +,3736,29711,29711,0,0,0< LINE:9/8/2005 0:00,FRDS,CDR-828005_9_08.FCDR_1.6718.FRDS.11331,5346713 +,2610,20778,20778,0,0,0<
This is what I get for SMB (note the print is "LINE:$mem<":
<INE:9/8/2005 0:00,FRDS,CDR-827705_9_08.FCDR_1.6718.FRDS.11328,1028217 +0,5020,40018,40018,0,0,0 <INE:9/8/2005 0:00,FRDS,CDR-827805_9_08.FCDR_1.6718.FRDS.11329,8837858 +,4315,34243,34243,0,0,0 <INE:9/8/2005 0:00,FRDS,CDR-827905_9_08.FCDR_1.6718.FRDS.11330,7652257 +,3736,29711,29711,0,0,0 <INE:9/8/2005 0:00,FRDS,CDR-828005_9_08.FCDR_1.6718.FRDS.11331,5346713 +,2610,20778,20778,0,0,0
This is how I'm making the SMB call:
`smbclient //oh-youn-f2/engineering -W Dobson -U $user_login%$user_pas +swd -c "cd Common/AMA_Reconcile/AMA_Transferred/;get $infile incoming/$infile"`;
I'm sure its something like a chomp or something, but I can't figure it out
thanks
Jimbus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text strangeness after using SMB to get a file
by Paladin (Vicar) on Sep 09, 2005 at 21:24 UTC | |
by ghenry (Vicar) on Sep 10, 2005 at 14:27 UTC | |
by jimbus (Friar) on Sep 11, 2005 at 02:41 UTC | |
by ghenry (Vicar) on Sep 11, 2005 at 06:51 UTC | |
|
Re: Text strangeness after using SMB to get a file
by AReed (Pilgrim) on Sep 09, 2005 at 23:04 UTC | |
|
Re: Text strangeness after using SMB to get a file
by InfiniteSilence (Curate) on Sep 09, 2005 at 22:02 UTC | |
by jimbus (Friar) on Sep 11, 2005 at 02:33 UTC |