Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Basics of extracting data from CSV files


beatsie - 5:27 pm on Dec 18, 2003 (gmt 0)


Hi Everyone

What i have to accomplish is to basically reformat one CSV file into another.

Here is an example of the structure of the CSV data im dealing with

value1,value2,value3a¦value3b¦value3c¦value4c¦,value4

So as you can see the third field has multiple values delimited by the ¦ symbol

What i need to do is to basically replace the ¦ symbol with commas , so that each data item is in its own field

i.e

value1,value2,value3a,value3b,value3c,value4c,value4

Then eventually remove all other data so i am just left with a CSV file of the values in the third field.

i.e

value3a,value3b,value3c,value4c

So i would like to try it in php , but might use perl depending on ease of implementation though i am more comfortable with PHP.

Anyone have any ideas or suggestions for an approach to this problem?

Thanks in advance

Karl


Thread source:: http://www.webmasterworld.com/php/2349.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com