Date: Fri, 14 Jan 2011 07:17:12 +0100 From: Polytropon <freebsd@edvax.de> To: Robert Bonomi <bonomi@mail.r-bonomi.com> Cc: freebsd-questions@freebsd.org Subject: Re: awk question: replacing "%d%s" by "%d %s" Message-ID: <20110114071712.c7a7fe7e.freebsd@edvax.de> In-Reply-To: <201101140022.p0E0MIW8029158@mail.r-bonomi.com> References: <20110113062819.4ecb89d9.freebsd@edvax.de> <201101140022.p0E0MIW8029158@mail.r-bonomi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 13 Jan 2011 18:22:18 -0600 (CST), Robert Bonomi <bonomi@mail.r-bonomi.com> wrote: > True. But > sub(nr,"[a-z]"," &"); > > does the trick. (tested on Freebsd 7.2) > > Explamation: "&" is a 'replacement side' magic incantation to the regex > library that means 'that which was matched by the pattern regex'. Doesn't work on my 7-STABLE system (20080811), awk stops: awk: syntax error at source line 78 source file konvertieren.awk context is sub(nr, "[a-z]", " >>> &" <<< ); awk: illegal statement at source line 79 source file konvertieren.awk But I'll keep your suggestion in the program source and test it on 8 as soon as my "new" home system is ready to use. At least, the & variant looks much better. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110114071712.c7a7fe7e.freebsd>