I wanted to match the first ASCII control character of an input string with awk but I stumbled upon what seems to be a bug on older BSDs:
#!/bin/bash
printf 'a \b c\n' |
awk 'match( $0, /[[:cntrl:]]/ ) { print RSTART }'
1
The expected output would be:
3
What could be wrong with the code?