[PLUG] Translating ^M to \n
Rodney W. Grimes
freebsd at gndrsh.dnsmgr.net
Tue Aug 13 00:42:51 UTC 2019
> > On Mon, 12 Aug 2019, Jason Barbier wrote:
> >
> > > https://emacs.stackexchange.com/questions/5779/how-to-convert-dos-windows-newline-characters-to-unix-format-within-gnu-emacs
> > > that covers it with emacs
> >
> > Jason,
> >
> > I looked at that thread and clicking on emacs' : in the status bar confirmed
> > it is seen as in UNIX mode, but I still see the ^M in the file.
> >
> > For anyone who wants to play with this, I uploaded the smallest of the four
> > files (~13M) to fileconvoy.com where it will be available for 5 days. The
> > URL is <https://tinyurl.com/y54p8xgv>.
>
> # file hatchery_returns-2019-08-12.csv
> hatchery_returns-2019-08-12.csv: ASCII text, with very long lines, with CR, LF line terminators
>
> # tr -d "\r" < hatchery_returns-2019-08-12.csv > hatchery_returns-2019-08-12.clean
> # file hatchery_returns-2019-08-12.clean
> hatchery_returns-2019-08-12.clean: ASCII text, with very long lines
>
> Please follow given examples exactly, tr "\r" "\n" was not given by
> anyone that I saw in the thread, no sure how are where you came up
> with that.
I was wrong here, someone did give that as an example, and oddly
this file is infact a "CR" only terminated lines, other than it
oddly as a LF as the first byte.
See my other mail, I think I have it fixed.... At least I have
a copy locally that reports the right "file" output, and opens
just fine in vi (not vim, not emacs, no, vi as in nvi from UCB).
--
Rod Grimes rgrimes at freebsd.org
More information about the PLUG
mailing list