[PLUG] Translating ^M to \n
Paul Heinlein
heinlein at madboa.com
Mon Aug 12 21:58:17 UTC 2019
On Mon, 12 Aug 2019, Rich Shepard wrote:
> I have large (~111M) .csv data files exported from a Microsoft Access
> database. Each file is one large block of text using ^M (carriage return)
> embedded as the line separator.
>
> 'sed' is probably the best tool to translate that control character to a
> newline (\n) but I don't know how to write '^M' so sed recognizes it as a
> single character. In emacs it displays colored cyan rather than white.
>
> A web search told me that ^M is equivalent to the linux \r, but not how to
> specify it for sed or emacs.
tr -d '\r' < infile.csv > outfile.csv
--
Paul Heinlein
heinlein at madboa.com
45°38' N, 122°6' W
More information about the PLUG
mailing list