0

This is the question about MergeContent Processor in Nifi. I would like to add newline when combining each csv flowfile, using MergeContent processor.

Similar to my problem, there was an answer to the question here.

link

It says I only have to set "Text" for Delimiter Strategy and type "shift+enter" for Dmarcator in property setting.

But it didn't work at all, printing "shift+enter" at the end of each flow file. I also tried "\n","\n" [shift+enter] and other ways and none of them works.

Expected output:

column1, column2, column3

value1, value2, value3,
value4, value5, value6,

Actual output:

column1, column2, column3

value1, value2, value3 shift+enter value4, value5, value6 shift+enter,,,
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Micro_Andy
  • 93
  • 1
  • 9
  • The same way like this: https://stackoverflow.com/questions/56218104/apache-nifi-replace-text-processor-to-use-control-character-as-delimiter/56218650?r=SearchResults#56218650 – daggett May 23 '19 at 07:43
  • I put , ${literal('\n'):unescapeXml()} in Demarcator for property setting. And it worked! Thank you so much! – Micro_Andy May 23 '19 at 09:38
  • symbol with code 10 stands for `LF` or `\n`. means you have to use this expression `${literal(' '):unescapeXml()}` – daggett May 23 '19 at 09:42

2 Answers2

1

You aren't supposed to type in "shift+enter" into the demarcator, you press those keys while in the demarcator value field to create a new line. The value should field should still appear as blank when looking at it, but there will be a new line character if you have pressed those keys.

Bryan Bende
  • 18,320
  • 1
  • 28
  • 39
0

symbol with code 10 stands for LF or \n.

https://en.wikipedia.org/wiki/Newline#Representation

means you have to use following expression: ${literal('
'):unescapeXml()}

daggett
  • 26,404
  • 3
  • 40
  • 56