我已经获得了包含电子商务平台产品信息的CSV文件。 CSV文件包含具有相同产品ID和多个说明的多行。每个值由“^”而不是逗号分隔。 我想要实现的是将这些多行合并为一个逗号分隔,并且只有一行产品信息。所以我的问题是组合多个具有相同属性的行。具有相同ID的CSV文件多行代码
这是今天
productID^Element^Value<br>
id01^Status^01<br>
id01^edited^2016-01-01<br>
id01^Longdesc^Here goes the description<br>
id01^Longdesc^Here is the second line of description<br>
id01^longdesc^And the third row<br>
id01^image^Link to image 1<br>
文件的格式化这就是我要找的实现:
ID01, 2016-01-01, Here goes the description Here is the second line of description And the third row, link to image
另一个想法是把结构的很好的XML文件。
希望你们有这方面的一些很好的解决方案,可以帮助我。
谢谢!
这似乎是一个很简单的问题 - 遍历线,解析它们,并重新打印出来你最喜欢的方式。你到目前为止尝试了什么? –
我试过这个:http://stackoverflow.com/questions/25610886/how-to-concatenate-values-from-multiple-rows-with-the-same-id-to-a-comma-separat但是不能得到长话结合。 – Koolander