You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by gemlan123 <ji...@bell.ca> on 2020/07/31 19:09:41 UTC
need parse first few lines to customize a header for csv
I have some csv files with first few lines like this:
topic: abc ,,
some comments: xxx,,
col1,col2,col3,flag
,,,,,
,,,col4,col5
data1,data2,data3,data4,data5
......
I want to parse the first 4 lines and have a flowfile like:
col1,col2,col3,col4,col5
data1,data2,data3,data4,data5
try to use RouteText processor to achieve it and if possible try to avoid
scan all the lines within the file.
--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
Re: need parse first few lines to customize a header for csv
Posted by Mike Thomsen <mi...@gmail.com>.
The key here would be "is it the same?" If it's not, the most
practical solution would be to pursue a business decision to fix the
upstream process.
On Sat, Aug 1, 2020 at 2:47 AM Jens M. Kofoed <jm...@gmail.com> wrote:
>
> Hi
>
> What about the ReplaceText. If you know it will always be 4 header lines, you could use a regex like this: ^topic.*?$ ^.*?$ ^.*?$ ^.*?$
> or using 4 ReplaceText after each other, only replacing First-Line.
>
> regards
> Jens M. Kofoed
>
> Den fre. 31. jul. 2020 kl. 21.09 skrev gemlan123 <ji...@bell.ca>:
>>
>> I have some csv files with first few lines like this:
>>
>> topic: abc ,,
>> some comments: xxx,,
>> col1,col2,col3,flag
>> ,,,,,
>> ,,,col4,col5
>> data1,data2,data3,data4,data5
>> ......
>>
>> I want to parse the first 4 lines and have a flowfile like:
>> col1,col2,col3,col4,col5
>> data1,data2,data3,data4,data5
>>
>> try to use RouteText processor to achieve it and if possible try to avoid
>> scan all the lines within the file.
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
Re: need parse first few lines to customize a header for csv
Posted by "Jens M. Kofoed" <jm...@gmail.com>.
Hi
What about the ReplaceText. If you know it will always be 4 header lines,
you could use a regex like this: ^topic.*?$ ^.*?$ ^.*?$ ^.*?$
or using 4 ReplaceText after each other, only replacing First-Line.
regards
Jens M. Kofoed
Den fre. 31. jul. 2020 kl. 21.09 skrev gemlan123 <ji...@bell.ca>:
> I have some csv files with first few lines like this:
>
> topic: abc ,,
> some comments: xxx,,
> col1,col2,col3,flag
> ,,,,,
> ,,,col4,col5
> data1,data2,data3,data4,data5
> ......
>
> I want to parse the first 4 lines and have a flowfile like:
> col1,col2,col3,col4,col5
> data1,data2,data3,data4,data5
>
> try to use RouteText processor to achieve it and if possible try to avoid
> scan all the lines within the file.
>
>
>
>
>
> --
> Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
>