Awk Anomaly
Posted: 25 Jan 2015, 20:38
Don't see how this can be explained as not being a bug Logically the null string should match position zero, giving an index of 0, as one would expect.
Code: Select all
guest@porteus:~$ awk 'BEGIN{print "+"x y"+"; print index(x,y)}'
++
1
guest@porteus:~$ awk 'BEGIN{x="lib";print "+"x y"+"; print index(x,y)}'
+lib+
1
guest@porteus:~$ awk 'BEGIN{x="lib";print "+"x y"+"; print index(x,"l")}'
+lib+
1