Search code examples
windowsreplacecmd

How to replace newline in csv with fart.exe at Windows command-line?


In FART.exe find/replace tool, i’m having some trouble with newline char:

> set lf=^& echo.
> fart myfile.csv lf "],["
Replaced 0 occurence(s) in 0 file(s).

Nothing gets replaced. What's the correct (and simplest) way to do this? The line-terminators in the file might be CarriageReturn + LineFeed, not sure. How to check for both?

(PS, fart is the fastest replace tool i've tested on Windows. Tested much faster than repl.bat, jrepl.bat, findrepl.bat, sfk.ext, and powershell.)


Solution

  • edited to adapt to comments

    fart includes a switch (-C or --c-style) to indicate that input/output strings contain C-style extended characters. In this case quotes are not needed around the search or replacement strings as there are no special characters in the command line:

    fart -C myfile.csv \r\n ],[