It appears the situation is more complex than I thought; string indexing is apparently 1-based, not 0-based as I previously thought.
The matter is summarised at: <http://lists.gnu.org/archive/html/bug-gnu-utils/2004-09/ msg00083.html>
Indeed the following works as expected: % echo 1234 | mawk '{print substr($0,1,3)}'
It may be undesirable behaviour, but it's not a bug per se.
- Andrew
It appears the situation is more complex than I thought; string indexing is apparently 1-based,
not 0-based as I previously thought.
The matter is summarised at: <http:// lists.gnu. org/archive/ html/bug- gnu-utils/ 2004-09/
msg00083.html>
Indeed the following works as expected:
% echo 1234 | mawk '{print substr($0,1,3)}'
It may be undesirable behaviour, but it's not a bug per se.
- Andrew