Bug 8371

Summary: awk: missing support for length function w/out paren
Product: Busybox Reporter: Mike Frysinger <vapier>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Other   
URL: http://http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
See Also: https://bugs.gentoo.org/show_bug.cgi?id=561606
Host: Target:
Build:

Description Mike Frysinger 2015-09-27 06:41:20 UTC
POSIX allows for calling the length function w/out any parentheses:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html

length[([s])]
Return the length, in characters, of its argument taken as a string, or of the whole record, $0, if there is no argument.

simple testcase:
$ echo asdf | gawk '{print length}'
4
$ echo asdf | busybox awk '{print length}'
awk: cmd. line:1: Unexpected token

it does support the implicit $0, but only when () are used:
$ echo asdf | busybox awk '{print length()}'
4
Comment 1 Denys Vlasenko 2015-10-02 00:42:55 UTC
Fixed in git.