[PLUG] Translating ^M to \n

Michael Ewan michaelewan15 at gmail.com
Mon Aug 12 23:17:28 UTC 2019


tr is your friend
tr '\013' '\n' < old_file > new_file
this will probably work also
tr '\r' '\n' < old_file > new_file

On Mon, Aug 12, 2019 at 2:28 PM Rich Shepard <rshepard at appl-ecosys.com>
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.
>
> Pointers needed.
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list