Forum Discussion

Akhil's avatar
Akhil
New Contributor
4 years ago

How to remove Escape character while file writing CSV formatter

I am trying to write a file with custom header separated by semi-colon (reading header from expression library as string)followed by data.
While writing using CSV formatter escape character ‘\’ is getting added as prefix for ‘;’.

Please suggest how i can remove this ‘\’

5 Replies

  • Supratim's avatar
    Supratim
    Contributor III

    @Akhil try below config-

    Below is data preview

    • Akhil's avatar
      Akhil
      New Contributor

      Thanks Supratim for your reply, but as per my requirement the value should not be in quote and write CSV header will be disabled

      • Supratim's avatar
        Supratim
        Contributor III

        Then remove quotation from quote character.

        Thanks,
        Supratim
        (+91)923-263-3466

        This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

  • Akhil's avatar
    Akhil
    New Contributor

    I am reading header details from expr file as below
    header:“header1;header2;header3”
    since my delimiter is ; CSV formatter is prefixing escape character() to my header ‘;’

    If i am replacing with(,) it to header:“header1,header2,header3” its working as expected but my business requirement is to have delimiter as ;

    • nishantagarwal's avatar
      nishantagarwal
      New Contributor II

      @Akhil if you are interested only in data , try using .replaceAll(“,” , “;”) in Mapper after Parser.

      You will get data something like this : Candace;Kelley;10/29/21;160206159956;Dalbeattie;Customer Relations

      Hope this helps.