Re: BSD-awk print() Behavior

From: Andreas Kusalananda Kähäri <andreas.kahari_at_abc.se>
Date: Tue, 21 Feb 2023 11:57:25 UTC
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.


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.