Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi how to delete different strings through replacetext in CSV

avatar
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

avatar
Master 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

avatar
Master 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.

avatar
Explorer

Thanks it worked perfectly !!