Re: BSD-awk print() Behavior
- Reply: Polytropon : "Re: BSD-awk print() Behavior"
- In reply to: Andreas Kusalananda Kähäri : "Re: BSD-awk print() Behavior"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 21 Feb 2023 12:06:04 UTC
> ----------------------------------------
> From: Andreas Kusalananda Kähäri <andreas.kahari@abc.se>
> Date: Feb 21, 2023, 3:57:25 AM
> To: Sysadmin Lists <sysadmin.lists@mailfence.com>
> Cc: Freebsd Questions <freebsd-questions@freebsd.org>
> Subject: Re: BSD-awk print() Behavior
>
>
> On Tue, Feb 21, 2023 at 12:53:14PM +0100, Sysadmin Lists wrote:
> > > ----------------------------------------
> > > From: Andreas Kusalananda Kähäri <andreas.kahari@abc.se>
> > > Date: Feb 21, 2023, 2:14:21 AM
> > > To: Sysadmin Lists <sysadmin.lists@mailfence.com>
> > > Cc: Freebsd Questions <freebsd-questions@freebsd.org>
> > > Subject: Re: BSD-awk print() Behavior
> > >
> > >
> > > On Tue, Feb 21, 2023 at 01:24:41AM +0100, Sysadmin Lists wrote:
> [cut]
> > > Yes, because Vim automatically interprets DOS text files as ordinary
> > > text. I'm asssuming that while editing file_1 in Vim, you see "[dos]"
> > > at the bottom of the screen?
> > >
> > >
> >
> > Good explanation. I found the hidden character before reading your email using
> > `cat -e' which printed the ^M character, but didn't know awk could move the
> > cursor around like that. Sounds like a useful (and dangerous) hack.
> >
> > $ cat -e file_{1,2}
> > https://github.com/^M$
> > https://github.com/^M$
> > https://github.com/$
> > https://github.com/$
> >
> > vim does indeed say [dos] at the bottom of file_1. Now I know sqlite3 creates
> > dos files even on unix-like systems.
>
> I'm guessing that if you look in your database, the data there is
> inserted with carriage-returns at the end of the strings. It's not
> sqlite3 that creates DOS files, it's just giving you what was inserted
> into the tables. If you want to track down where the carriage-returns
> came from originally, you have to search further upstream.
>
Nope, I'm good. This was just a one-off task I needed to perform. I managed to
complete it using yank-and-paste in vim, but wouldn't have been able to
mentally move on without knowing what was "breaking" in awk. Turns out it
wasn't awk, and I learned a few new tricks tracking this issue down -- which is
what makes this kind of work fun.
Thanks again for the help.
(Now that I think of it, the carriage-returns are inserted by the web browser
of course.)
--
Sent with https://mailfence.com
Secure and private email