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

Never moon a werewolf!

In reply to Text strangeness after using SMB to get a file by jimbus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.