You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Manee <ma...@gmail.com> on 2017/06/13 09:35:21 UTC

Comma to Pipe line Issues in Nifi

I am  having an issue in one  file. Conversion of comma to Pipe symbol .In
that  File we have some fields that can separate the fields using the comma
as delimiter, but some values actually contain commas, such as ""Hadoop,
Nifi"" These values are surrounded by quotes to indicate the characters
within should be treated as part of the field, but I don't know how to parse
it to take this into same values.How to resolve this issues .I am struck up
on this issues could anyone help me out to resolve this issues. 



-----
Thanks,
Manee
--
View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Comma-to-Pipe-line-Issues-in-Nifi-tp16185.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.

Re: Comma to Pipe line Issues in Nifi

Posted by Andy LoPresto <al...@apache.org>.
If you are looking for the opposite (don’t replace commas when they are surrounded by quotes), the following regex should work:

Search value: ([^,"]*),([^,"]*)(?=,|$)
Replacement: $1|$2

The pattern searches for “a collection of 0 or more characters other than a comma or quote (group 1), followed by a comma, followed by another collection of 0 or more non-quote-or-comma characters (group 2), which must be followed by a comma or the end of the line” and replaces the central comma with a pipe delimiter.



Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Jun 13, 2017, at 9:22 AM, Andy LoPresto <al...@apache.org> wrote:
> 
> The ReplaceText processor will replace those characters even if they are surrounded by double quotes.
> 
> <Screen Shot 2017-06-13 at 9.15.49 AM.png><Screen Shot 2017-06-13 at 9.15.17 AM.png>
> 
> --------------------------------------------------
> Standard FlowFile Attributes
> Key: 'entryDate'
> 	Value: 'Tue Jun 13 09:21:17 PDT 2017'
> Key: 'lineageStartDate'
> 	Value: 'Tue Jun 13 09:21:17 PDT 2017'
> Key: 'fileSize'
> 	Value: '16'
> FlowFile Attribute Map Content
> Key: 'filename'
> 	Value: '1704151514689652'
> Key: 'path'
> 	Value: './'
> Key: 'uuid'
> 	Value: '2e225af2-87f3-4bb7-b716-7052ae2db5a0'
> --------------------------------------------------
> ""Hadoop| NiFi”"
> 
> Andy LoPresto
> alopresto@apache.org <ma...@apache.org>
> alopresto.apache@gmail.com <ma...@gmail.com>
> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
> 
>> On Jun 13, 2017, at 2:35 AM, Manee <mani.nathan08@gmail.com <ma...@gmail.com>> wrote:
>> 
>> I am  having an issue in one  file. Conversion of comma to Pipe symbol .In
>> that  File we have some fields that can separate the fields using the comma
>> as delimiter, but some values actually contain commas, such as ""Hadoop,
>> Nifi"" These values are surrounded by quotes to indicate the characters
>> within should be treated as part of the field, but I don't know how to parse
>> it to take this into same values.How to resolve this issues .I am struck up
>> on this issues could anyone help me out to resolve this issues.
>> 
>> 
>> 
>> -----
>> Thanks,
>> Manee
>> --
>> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Comma-to-Pipe-line-Issues-in-Nifi-tp16185.html <http://apache-nifi-developer-list.39713.n7.nabble.com/Comma-to-Pipe-line-Issues-in-Nifi-tp16185.html>
>> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com <http://nabble.com/>.
> 


Re: Comma to Pipe line Issues in Nifi

Posted by Andy LoPresto <al...@apache.org>.
The ReplaceText processor will replace those characters even if they are surrounded by double quotes.



--------------------------------------------------
Standard FlowFile Attributes
Key: 'entryDate'
	Value: 'Tue Jun 13 09:21:17 PDT 2017'
Key: 'lineageStartDate'
	Value: 'Tue Jun 13 09:21:17 PDT 2017'
Key: 'fileSize'
	Value: '16'
FlowFile Attribute Map Content
Key: 'filename'
	Value: '1704151514689652'
Key: 'path'
	Value: './'
Key: 'uuid'
	Value: '2e225af2-87f3-4bb7-b716-7052ae2db5a0'
--------------------------------------------------
""Hadoop| NiFi”"

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Jun 13, 2017, at 2:35 AM, Manee <ma...@gmail.com> wrote:
> 
> I am  having an issue in one  file. Conversion of comma to Pipe symbol .In
> that  File we have some fields that can separate the fields using the comma
> as delimiter, but some values actually contain commas, such as ""Hadoop,
> Nifi"" These values are surrounded by quotes to indicate the characters
> within should be treated as part of the field, but I don't know how to parse
> it to take this into same values.How to resolve this issues .I am struck up
> on this issues could anyone help me out to resolve this issues.
> 
> 
> 
> -----
> Thanks,
> Manee
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/Comma-to-Pipe-line-Issues-in-Nifi-tp16185.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.