[PLUG] Translating ^M to \n
Rodney W. Grimes
freebsd at gndrsh.dnsmgr.net
Tue Aug 13 01:03:06 UTC 2019
> > On 8/12/19 4:34 PM, Rich Shepard wrote:
> > > On Mon, 12 Aug 2019, Michael Ewan wrote:
> > >
> > >> tr is your friend
> > >> tr '\013' '\n' < old_file > new_file
> > >> this will probably work also
> > >> tr '\r' '\n' < old_file > new_file
> > >
> > > Michael,
> > >
> > > As I've written, it should but doesn't.
> > >
> > > The smallest file can be downloaded from <https://tinyurl.com/y54p8xgv>.
> >
> > Looks like a mixture of line endings. I'm seeing both CR and LF in that
> > file.
> >
> > [galens at toto ~]$ wc -l Downloads/hatchery_returns-2019-08-12.csv
> > 102 Downloads/hatchery_returns-2019-08-12.csv
> >
> > Converting CR to LF and then counting lines yields 10801.
> >
> > There's also one instance of a CRLF at the end of the file.
> >
> > Perhaps there are some LF characters embedded in strings. I didn't
> > bother to dive in any farther.
>
> This looks like a file that was CRLF ending after it
> has been mangled by a web download.... and was treated
> as a text file type rather than a binary file so line
> ending mangling did occur.
I realized after sending this.. it may of very well been
either you uploading the file, or me downloading it that
did additional damage.
Can you wrap that file in a protected format so we know
that what I download is infact what you have on your machine,
like put it in .tgz file?
Regards,
--
Rod Grimes rgrimes at freebsd.org
More information about the PLUG
mailing list