Search code examples
javascriptgroovy

Removing Carriage Return (Control-M) in Groovy


My file is having unwanted Control-M characters at the end of the records and because of this file is not getting processed.

Sample file (CSV) Sample file

Please suggest how can I use ReplaceAll function in Groovy to remove it .


Solution

  • Something like this should work....

    csvFileContent.replaceAll("\r\n", "\n");