[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "-M" option does not work with "+" "-" characters
From: |
Hyunho Cho |
Subject: |
Re: "-M" option does not work with "+" "-" characters |
Date: |
Mon, 06 Jul 2020 13:11:54 +0900 |
thanks for your patch.
I have applied your patch and tested but weird things happened.
this is my test code
bash$ cat a.awk
{
for (i = 1; i <= NF; i++) {
switch ($i) {
case "+" : case "-" :
case "*" : case "/" :
case "%" : case "^" :
printf $i; break
case /[a-z]/ :
printf $i; break
case /[0-9]/ :
printf $i; break
case /[ \t]/ :
printf $i; break
default :
print " wrong character " i " th: " $i
}
}
print ""
}
# without "-M" option, all works fine
bash$ awk -vFS="" -f a.awk <<< 12+45
12+45
# if i add "-M" option then "+" "-" characters make errors like this
bash$ awk -vFS="" -M -f a.awk <<< 12+45
12+ wrong character 4 th:
wrong character 5 th:
# if i check 4 th and 5 th characters with od command
# there are weird "nul" characters exist
bash$ awk -vFS="" -M -f a.awk <<< 12+45 od -a
0000000 1 2 + sp w r o n g sp c h a r a c
0000020 t e r sp 4 sp t h : sp nul nl sp w r o
0000040 n g sp c h a r a c t e r sp 5 sp t
0000060 h : sp nul nl nl
0000066