NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/48667 (awk: man page for gsub shows wrong order of arguments)



Synopsis: awk: man page for gsub shows wrong order of arguments

State-Changed-From-To: open->feedback
State-Changed-By: dholland%NetBSD.org@localhost
State-Changed-When: Fri, 21 Mar 2014 18:13:52 +0000
State-Changed-Why:
     gsub(r, t, [s])
             same as sub() except that all occurrences of the regular
             expression are replaced; sub() and gsub() return the number of
             replacements.

     sub(r, t, [s])
             substitutes t for the first occurrence of the regular expression
             r in the string s.  If s is not given, $0 is used.

% echo hi | awk '{ sub(".", "x", $0); print $0; }'
xi

Seems to me like it's doing what the man page says. Can you clarify?





Home | Main Index | Thread Index | Old Index