Where to Start with pipe delimited file filtering

Discussion in 'PHP' started by cbryan374, Feb 27, 2010.

  1. cbryan374

    cbryan374 New Member

    Joined:
    Feb 27, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have a file supplied to me by a vendor in either xml format, or pipe delimited format. What I need to do is read all of the data in and filter out any inactive products. The pipe file in column[18] is where the the product is set to active, either 0,1. Finally I will write the file to a new pipedelimited csv.
    1.) would xml be easier?
    2.) How do I start with this?

    Here is a sample of some data in the pipe file.
    model|name|price|category|loc|image|description|weight|option_type|option_value|suggested_retail|special_handling|manufacturer|manufacturer_code|packaging|in_stock|last_updated|active|
    ABC123|ABC name|2.45|Tools||image.jpg|ABC Tool|3.2|||6.99|YES|Great Tool Company|1-ABC123|Yes|02-01-2010|1|

    This is what I want to do:
    skip row 1
    read each row, if active=1 and there is any information in option_type ,write each row to "activewith options.csv"

    then skip row 1,
    read if active=1 and option_type is blank, write each row to "active with out options.csv
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice