1834447 Members
2778 Online
110067 Solutions
New Discussion

How to delete \N

 
hpuxrox
Respected Contributor

How to delete \N

Im trying to delete \N from a file. This is literal \N not the return charter.

I try,

tail crfdata.csvtmp10903 | tr -d '\\N'

This is deleting anything with N in the file. Does anyone know how to do this correctly?
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: How to delete \N

Hi:

# tr -d "\016"

See the ascii(5) manpages.

Regards!

...JRF...
Sandman!
Honored Contributor

Re: How to delete \N

Try with sed(1) instead:

# sed 's/\\N//' crfdata.csvtmp10903
Laurent Menase
Honored Contributor

Re: How to delete \N

In fact tr treat char by char
tr -d "\\N" will remove \ and N from the file
so
\ANC\DERN
will be transformed in:
ANCDER

indeed it is better to use sed -e "s/\\N//g" outputfile

the g is for removing all the \N
without g it will be only the first one.