如何将此csv文件拆分为多个内容? [英] How to split this csv file into multiple contents?
问题描述
我有CSV文件,其中包含以下内容, Input.csv
I have CSV File which having below contents, Input.csv
Sample NiFi Data demonstration for below
Due dates 20-02-2017,23-03-2017
My Input No1 inside csv,,,,,,
Animals,Today-20.02.2017,Yesterday-19-02.2017
Fox,21,32
Lion,20,12
My Input No2 inside csv,,,,
Name,ID,City
Mahi,12,UK
And,21,US
Prabh,32,LI
我需要将整个csv(Input.csv)分成两个部分,例如InputNo1.csv和InputNo2.csv.
I need to split above whole csv(Input.csv) into two parts like InputNo1.csv and InputNo2.csv.
For InputNo1.csv should have below contents only.,
Animals,Today-20.02.2017,Yesterday-19-02.2017
Fox,21,32
Lion,20,12
For InputNo2.csv should have below contents.,
Name,ID,City
Mahi,12,UK
And,21,US
Prabh,32,LI
是否可以使用现有处理器将csv转换为NiFi中的多个部分?
Is this possible to convert csv into Multiple parts in NiFi possible with existing processors?
推荐答案
是.
使用ReplaceText
处理器删除全局头,使用SplitContent
将生成的流文件拆分为多个流文件,使用另一个ReplaceText
删除剩余的注释字符串,因为SplitContent
需要文字字节字符串,而不是regex,然后执行正常的SplitText
操作.
Use the ReplaceText
processor to remove the global header, use SplitContent
to split the resulting flowfile into multiple flowfiles, use another ReplaceText
to remove the leftover comment string because SplitContent
needs a literal byte string, not a regex, and then perform the normal SplitText
operations.
这是针对您在问题中提供的输入的模板.
Here is a template specific to the input you provided in your question.
这篇关于如何将此csv文件拆分为多个内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!