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.

Replace /N with empty string in CSV File

Solved Go to solution

Replace /N with empty string in CSV File

New Contributor

I have a CSV file in which nulls are represented by "/N". How can i go about replacing this with an empty string ''.

Sample

Year Age City Date

2013 \N London \N

2019 56 \N \N

2015 20 \N 12/12/2019


I would like to replace this, so that the file looks like the below.

Year Age City Date

2013 London

2019 56

2015 20 12/12/2019


Which processors can i use to achieve this and what is the syntax to be used.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Replace /N with empty string in CSV File

New Contributor

I was able to solve the problem by using ReplaceText processor below. For Replacement Value, I hit "tab"

110187-replacetext.png

5 REPLIES 5

Re: Replace /N with empty string in CSV File

Mentor

@FA

Use a ReplaceText processor which replaces \A\n|\n*\s*(?=\n) with '' (empty replacement value). The search regex looks for:

\n*\s*(?=\n) - newline (0 or more) followed by whitespace (0 or more) followed by a newline.

110192-1564787672770.png

Re: Replace /N with empty string in CSV File

New Contributor

This was helpful

Re: Replace /N with empty string in CSV File

Community Manager

The above question and the entire response thread below were originally posted in the Community Help track. On Sat Aug 3 14:59 UTC 2019, a member of the HCC moderation staff moved it to the Data Ingestion & Streaming track. The Community Help Track is intended for questions about using the HCC site itself.

Re: Replace /N with empty string in CSV File

New Contributor

I was able to solve the problem by using ReplaceText processor below. For Replacement Value, I hit "tab"

110187-replacetext.png

Re: Replace /N with empty string in CSV File

Mentor

@FA

Great that your problem was resolved.