help-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about behavior changes due to version differences in gawk


From: hsp.yaruki100-TRIBE-SOUL
Subject: Question about behavior changes due to version differences in gawk
Date: Wed, 17 Jul 2024 11:44:42 +0900

Hello,

in gawk, the behavior after executing the gsub function was different bet ween 
version 3.1.7 and 4.2.1.

The files and scripts used for this operation are listed below.

[in.txt]

0000 2 awk

[test.sh]

#/bin/sh

cat in.txt | gawk '
      {
            a=$1
            gsub(/^"? *| *"?$/, "", a);
            if (a  == 0{
                  print "TRUE"
            } else {
                  print "FALSE"
            }
      }
'
 
[3.1.7 Result]
TRUE

[4.2.1 Result]
FALSE

is this a change in behavior due to the following release?

https://lists.gnu.org/archive/html/info-gnu/2011-06/msg00013.html

---
2. The POSIX 2008 behavior for `sub' and `gsub' are now the default.

   THIS CHANGES BEHAVIOR!!!!
---

if not, please explain why this behavior change is happening.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]