Results 1 to 6 of 6
  1. #1
    ABW Ambassador CrazyGuy's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,463
    Looking at the TigerDirect DataFeed for the first time ...

    Excel loads the file one record per line
    Text editor loads the file one record per line
    but
    My Perl script loads the whole file into one line of a list.

    This has stopped me in my tracks as I've never had to use anything other than very simple code to load a raw file into a list:

    open(DATA_FEED,"$base_path/$file");
    @products=<DATA_FEED>;
    close(DATA_FEED);

    LOL - I must be using that in a dozen different scripts so it's come as a real blow when it doesn't work here.

    (thinks of something ... scurries off ... returns)

    Mmmmh - I downloaded the feed, loaded it into my text editor and saved it back out again, then uploaded it. That works - so there must be something at least slightly unusual terminating the rows.

    I really don't want to have to process this manually - anyone come across this or have any bright perl ideas to account for it?

    Are you Crazy?

  2. #2
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    You may have to convert the line endings from Windows to UNIX or vicey-versa.

    A tool I use alot to convert files is 'flip' (on my Linux and Solaris machines).

    It's in the standard distribution packages in Debian GNU/Linux Woody release and is GPL, RPMs can be found here for Redhat and Mandrake.

  3. #3
    ABW Ambassador CrazyGuy's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,463
    Ffoc - I think you're right. Presumably this is Windows style by default. Need to find out if/why that's the case - seems to me that Unix style files transfer to Win better than the other way round.

    Thanks for the pointer to "flip". I'll follow up on that util as I'll no doubt need it some time, even if I get this changed.

    Are you Crazy?

  4. #4
    ABW Ambassador FFoc's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,015
    It's because one is bloated and has everything under the sun installed in it by default (and does none of them particularly well), whereas the other has separate, discreet tools for everything you could imagine (and each of those tasks have been honed to a razor-perfection).

    And, scuse my exaggerating.

  5. #5
    Newbie
    Join Date
    January 18th, 2005
    Posts
    8
    If you're working with the feed on unix/linux then do this:

    tr '\015' '\n' < feed.txt > newfeed.txt

    That will create a new file called newfeed.txt with one record per line. Works for me.

  6. #6
    ABW Ambassador CrazyGuy's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,463
    That's quite elegant - Pete came up with a short script in this thread:

    http://abw.infopop.cc/6/ubb.x?a=tpc&...9&m=8206049052

    Are you Crazy?

  7. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. CJ homelink format
    By matt j in forum Commission Junction - CJ
    Replies: 0
    Last Post: December 12th, 2006, 04:18 PM
  2. New format
    By jerseyjim in forum Midnight Cafe'
    Replies: 0
    Last Post: May 3rd, 2005, 11:02 PM
  3. asinsearch.format and grid list format
    By speedcreed in forum Cusimano.com Scripts
    Replies: 1
    Last Post: August 21st, 2003, 09:50 AM
  4. New Format
    By Haiko de Poel, Jr. in forum Midnight Cafe'
    Replies: 36
    Last Post: August 24th, 2002, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •