Quelqu'un peut-il m'expliquer pourquoi aw (s) sub () / gsub () fonctionne comme ça?

Je sais awk peut faire texte/chaîne de substitution, avec sub() et gsub() comme:

kent$ echo "fffff"|awk '{gsub("f", "b")}1'
bbbbb

ou

kent$ echo "fffff"|awk '{gsub(/f/, "b")}1'
bbbbb

Cependant aujourd'hui, j'ai fait une faute de frappe erreur, j'ai écrit la ligne comme:

kent$ echo "fffff"|awk '{gsub('f', "b")}1'

Mais awk n'ai pas à me plaindre à ce sujet, mais a généré de sortie comme d'habitude, bien sûr, inattendus de sortie, il m'a fallu quelque temps pour trouver l'erreur. La sortie awk m'a donné était:

bfbfbfbfbfb

un autre exemple:

kent$ echo "fafafafafXX"|awk '{gsub('fa', "B")}1'
BfBaBfBaBfBaBfBaBfBXBXB

exemple avec sub() est étrange aussi:

kent$  echo "thanks in advance"|awk '{sub('a', "B")}1'
Bthanks in advance

Quelqu'un pourrait-il m'expliquer comment était l'étrange substitution fait?

kent$  awk --version
GNU Awk 4.0.2

MODIFIER

merci pour la réponse de Joni. peut-être cet exemple explique mieux, je viens de l'ajouter ici:

kent$  echo "thanks in advance"|awk '{f="k";sub('f', "B")}1'
thanBs in advance

kent$  echo "thanks in advance"|awk '{sub('th ank', "B")}1'
awk: cmd. line:2: {sub(th
awk: cmd. line:2:        ^ unexpected newline or end of string

source d'informationauteur Kent