Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NiFi how to delete different strings through replacetext in CSV

Solved Go to solution
Highlighted

NiFi how to delete different strings through replacetext in CSV

Explorer

I am using NiFi replacetext processor to delete some strings in csv file but somehow its not working.

Below is the search string:

(,Minutes.*\n|CellID|=|"|LogicRNCID|CGI|CellIndex|GCELL:LABEL)

below is snapshot:

Can anyone tell how to mention multiple string in search box and how to mention delete these in replacement value.

72707-capture1.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: NiFi how to delete different strings through replacetext in CSV

Super Guru

@Naeem Ullah Khan

Change the replace text Replacement Strategy to Regex Replace because you are using "|"(or operator) to search for all the possible instances in your input csv file by using Evaluation mode as Line-By-Line and change the Replacement value property to empty string.

.
Always Replace will replace the entire flowfile contents based on Evaluation mode property <value> without searching for any value.

ReplaceText Configs:-

73415-replacetext.png

Replacement Value as empty string

73414-replacement-value.png

Search Value

(,Minutes.*\n|CellID|=|"|LogicRNCID|CGI|CellIndex|GCELL:LABEL)

Replacement Value

Empty string set //we are searching for all the values above and replacing them with empty string

Replacement Strategy

Regex Replace //interprets search value as regex and replaces matched value with replacement values

Evaluation Mode

Line-by-Line //Run the 'Replacement Strategy' against each line separately (Line-by-Line) 

-

If the Answer addressed your question, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

2 REPLIES 2
Highlighted

Re: NiFi how to delete different strings through replacetext in CSV

Super Guru

@Naeem Ullah Khan

Change the replace text Replacement Strategy to Regex Replace because you are using "|"(or operator) to search for all the possible instances in your input csv file by using Evaluation mode as Line-By-Line and change the Replacement value property to empty string.

.
Always Replace will replace the entire flowfile contents based on Evaluation mode property <value> without searching for any value.

ReplaceText Configs:-

73415-replacetext.png

Replacement Value as empty string

73414-replacement-value.png

Search Value

(,Minutes.*\n|CellID|=|"|LogicRNCID|CGI|CellIndex|GCELL:LABEL)

Replacement Value

Empty string set //we are searching for all the values above and replacing them with empty string

Replacement Strategy

Regex Replace //interprets search value as regex and replaces matched value with replacement values

Evaluation Mode

Line-by-Line //Run the 'Replacement Strategy' against each line separately (Line-by-Line) 

-

If the Answer addressed your question, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

Highlighted

Re: NiFi how to delete different strings through replacetext in CSV

Explorer

Thanks it worked perfectly !!

Don't have an account?
Coming from Hortonworks? Activate your account here