<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question NiFi Updating header in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199510#M78509</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to update header of my CSV file with a regular expression to remove special chars from header line only. how to do that.?&lt;/P&gt;&lt;P&gt;i tried to do that by reading the file and on one route to RouteText,ReplaceText,ExtractText to get the firstline and storing it in headerline attribute. and another route to move the file without the header and tried to Merge it by using headerline from route1.&lt;/P&gt;&lt;P&gt;But It only shows header in output when i first file arrives from Route 1 into MergeContent processor as it has the headerline property where as if it gets it from Route 2 , the output file doesnt have the headerline as it doent have that property.&lt;/P&gt;&lt;P&gt;any idea how to solve this..?&lt;/P&gt;</description>
    <pubDate>Sat, 19 May 2018 02:36:02 GMT</pubDate>
    <dc:creator>saikrishna_tara</dc:creator>
    <dc:date>2018-05-19T02:36:02Z</dc:date>
    <item>
      <title>NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199510#M78509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to update header of my CSV file with a regular expression to remove special chars from header line only. how to do that.?&lt;/P&gt;&lt;P&gt;i tried to do that by reading the file and on one route to RouteText,ReplaceText,ExtractText to get the firstline and storing it in headerline attribute. and another route to move the file without the header and tried to Merge it by using headerline from route1.&lt;/P&gt;&lt;P&gt;But It only shows header in output when i first file arrives from Route 1 into MergeContent processor as it has the headerline property where as if it gets it from Route 2 , the output file doesnt have the headerline as it doent have that property.&lt;/P&gt;&lt;P&gt;any idea how to solve this..?&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 02:36:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199510#M78509</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2018-05-19T02:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199511#M78510</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11732/saikrishnatarapareddy.html" nodeid="11732" target="_blank"&gt;@Saikrishna Tarapareddy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you are willing to add &lt;STRONG&gt;user defined header&lt;/STRONG&gt; without replacing the &lt;STRONG&gt;special chars&lt;/STRONG&gt; from header line then&lt;BR /&gt;Use ExecuteStreamCommand processor with the below configs &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72929-executestreamcommand.png" style="width: 1484px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17636i43DE7D0BDB6D662C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72929-executestreamcommand.png" alt="72929-executestreamcommand.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in this processor we are routing all the lines except the first line i.e we are having the flowfile without header, &lt;/P&gt;&lt;P&gt;then use &lt;STRONG&gt;ReplaceText&lt;/STRONG&gt; processor with &lt;STRONG&gt;Prepend &lt;/STRONG&gt;as &lt;STRONG&gt;replacement Strategy &lt;/STRONG&gt;to add&lt;STRONG&gt; &lt;/STRONG&gt;your user defined header to the file.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72936-replacetext.png" style="width: 1998px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17637i587CC8F11413D634/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72936-replacetext.png" alt="72936-replacetext.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Search Value&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;(?s)(^.*$)&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Replacement Value&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&amp;lt;user-defined-header&amp;gt;&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Character Set&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;UTF-8&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Maximum Buffer Size&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;1 MB //change the value as per your flowfile size&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Replacement Strategy&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Prepend&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Evaluation Mode&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Entire text&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;By using this method we are not going to have the header line from the file then we are adding the header to the flowfile content by using Replace Text processor.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;instead of using ExecuteStreamCommand processor Use Record Oriented processors(like ConvertRecord) also we can do achieve this case.&lt;BR /&gt;Configure/enable &lt;STRONG&gt;csvreader/csvsetwriter&lt;/STRONG&gt; as controller services to read the flowfile content and change the &lt;STRONG&gt;Include Header Line &lt;/STRONG&gt;value to&lt;STRONG&gt; &lt;/STRONG&gt;&lt;STRONG&gt;false in csv setwrtier controller service.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then use ReplaceText processor to prepend the header by using this method &lt;STRONG&gt;also we need to define header&lt;/STRONG&gt; in the replace text processor.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/183313/how-to-change-csv-attributeheader-name-in-apache-n.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://community.hortonworks.com/questions/183313/how-to-change-csv-attributeheader-name-in-apache-n.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 05:54:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199511#M78510</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T05:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199512#M78511</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11732/saikrishnatarapareddy.html" nodeid="11732" target="_blank"&gt;@Saikrishna Tarapareddy&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;if you want to replace the special characters in header line then look into the below flow.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72931-replace-header.png" style="width: 2249px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17633i92374D65C49E302C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72931-replace-header.png" alt="72931-replace-header.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So we are splitting the file as line count 1 in SplitText processor.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;RouteOnAttribute Configs:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72932-routeonattribute.png" style="width: 1616px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17634i034E690D57C0E6F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72932-routeonattribute.png" alt="72932-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;non_header&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${fragment.index:gt(1)} //fragment index 1 is the header line.&lt;/PRE&gt;&lt;P&gt;Use &lt;STRONG&gt;non_header&lt;/STRONG&gt; relationship to feed &lt;STRONG&gt;MergeContent &lt;/STRONG&gt;processor.&lt;/P&gt;&lt;P&gt;Feed the &lt;STRONG&gt;unmatched &lt;/STRONG&gt;relationship to feed&lt;STRONG&gt; replace text &lt;/STRONG&gt;processor, now unmatched relationship gets only the &lt;STRONG&gt;fragment.index = 1 &lt;/STRONG&gt;flowfile i.e our &lt;STRONG&gt;header is in the flowfile content&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Use &lt;STRONG&gt;&lt;U&gt;Replace text processor:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now apply your logic to replace the special characters in the flowfile content.&lt;/P&gt;&lt;P&gt;Then feed the success relationship to Merge Content processor.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;MergeContent processor Configs:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72933-mergecontent.png" style="width: 2056px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17635i2E09939A5FDB00AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72933-mergecontent.png" alt="72933-mergecontent.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in mergecontent processor use&lt;STRONG&gt; Defragment &lt;/STRONG&gt;as &lt;STRONG&gt;MergeStrategy&lt;/STRONG&gt; so this processor will wait for all the fragments then does the merge.&lt;/P&gt;&lt;P&gt;Change the Delimiter Strategy to &lt;STRONG&gt;Text&lt;/STRONG&gt; and Demarcator to &lt;STRONG&gt;shift+enter.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;By following this method we are going to replace only the header line content and wait for all fragments and merge the contents of flowfile.&lt;/P&gt;&lt;P&gt;Reference flow.xml &lt;A href="https://community.cloudera.com/legacyfs/online/attachments/72934-replace-header.xml" target="_blank"&gt;replace-header.xml&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;If the Answer helped to resolve your issue, &lt;STRONG&gt;Click on Accept button below to accept the answer,&lt;/STRONG&gt; That would be great help to Community users to find solution quickly for these kind of issues.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 05:53:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199512#M78511</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T05:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199513#M78512</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;i thought about this , but the only issue is my files are huge and to split them by lines may not be ideal.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 03:54:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199513#M78512</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2018-05-19T03:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199514#M78513</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11732/saikrishnatarapareddy.html" nodeid="11732" target="_blank"&gt;@Saikrishna Tarapareddy&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Try with this approach once&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="74499-flow.png" style="width: 2407px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17632iD8716D4B16D45201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="74499-flow.png" alt="74499-flow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this flow we are forking once the file is pulled and on right side we are going to have all the contents without header&lt;/P&gt;&lt;P&gt;on Left side we are doing &lt;STRONG&gt;head -1&lt;/STRONG&gt; on the flowfile content to get only the header then by using replace text we are going to replacing the special characters.&lt;/P&gt;&lt;P&gt;In Both UpdateAttribute processors we are going to add &lt;STRONG&gt;GroupIdentifier and Order Attribute&lt;/STRONG&gt;, so that are going to use these attributes in Enforce Order processor.&lt;/P&gt;&lt;P&gt;By using EnforceOrder Processor we are waiting for header flowfile(left side) to reach first then only we are going to process without header flowfile(right side).&lt;/P&gt;&lt;P&gt;Then change the success queue configurations of EnforceOrder processor prioritizers as FirstInFirstOutPrioritizer .&lt;/P&gt;&lt;P&gt;By using MergeContent Processor to merge the header with the flowfile content.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 05:53:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199514#M78513</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T05:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi Updating header</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199515#M78514</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; , can you upload xml for recent solution &lt;/P&gt;,&lt;P&gt;@shu can you upload .xml file here for recent flow&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 22:22:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Updating-header/m-p/199515#M78514</guid>
      <dc:creator>nitindamle_123</dc:creator>
      <dc:date>2019-01-31T22:22:24Z</dc:date>
    </item>
  </channel>
</rss>

