[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] mixed LF/CRLF scripts: incorrect line numbers
From: |
Jannick |
Subject: |
Re: [bug-gawk] mixed LF/CRLF scripts: incorrect line numbers |
Date: |
Tue, 8 May 2018 18:37:54 +0200 |
Hi Arnold,
Many thanks for taking the time.
On Tue, 08 May 2018 09:35:25 -0600, address@hidden wrote:
> Gawk comes from a Unix heritage where LF ends lines, and this is backed up
> by POSIX. In order to make life easier (if not totally easy) for people
on
> Windows systems, gawk simply treats CR as whitespace.
Agree. And this is why - especially on Windows - /^[[:space:]]*$/ identifies
blank lines in CRLF files, while /^[[:blank:]]*$/ does as it does not see
the CR at
the end of the line. This is a subtle difference I got often trapped. May I
suggest
to make in the manual
(https://www.gnu.org/software/gawk/manual/gawk.html#Bracket-Expressions)
all characters in the character class :space: explicit? Here CR ('\r') in
the list
could help Windows users I believe.
> Making gawk treat a lone CR like LF would be a lot of work for very little
gain;
> you should let your text editor help you ensure that the line endings in
your
> source program are consistent.
Yes - understand. This is what I was thinking in the very beginning, too.
I'll have
a look into my editor if it can regularly check EOL consistency. Doing this
manually
would not be the best and efficient choice.
> Thanks,
>
> Arnold
Many thanks again,
J.