Comma to Pipe line Issues in Nifi

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Comma to Pipe line Issues in Nifi

Manee
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comma to Pipe line Issues in Nifi

Andy LoPresto-2
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
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Jun 13, 2017, at 2:35 AM, Manee <[hidden email]> 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.


signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comma to Pipe line Issues in Nifi

Andy LoPresto-2
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
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Jun 13, 2017, at 9:22 AM, Andy LoPresto <[hidden email]> 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
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Jun 13, 2017, at 2:35 AM, Manee <[hidden email]> 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.



signature.asc (859 bytes) Download Attachment
Loading...