awk question: replacing "%d%s" by "%d %s"
Polytropon
freebsd at edvax.de
Fri Jan 14 07:47:15 UTC 2011
On Fri, 14 Jan 2011 17:53:04 +1030, Wayne Sierke <ws at au.dyndns.ws> wrote:
> I suspect it is a transcription error by Robert in his email.
>
> From man awk:
>
> 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.
>
>
> So the correct syntax is:
>
> sub("[a-z]", " &", nr)
Works in this version, thanks! Reduction of 7 lines of code.
sub(from, to, where); is the correct form.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list