From owner-freebsd-questions@FreeBSD.ORG Fri Jan 14 06:17:16 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09457106566B for ; Fri, 14 Jan 2011 06:17:16 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id BF17E8FC14 for ; Fri, 14 Jan 2011 06:17:15 +0000 (UTC) Received: from r55.edvax.de (port-92-195-143-131.dynamic.qsc.de [92.195.143.131]) by mx02.qsc.de (Postfix) with ESMTP id 3B8801E5B4; Fri, 14 Jan 2011 07:17:14 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id p0E6HCqh004138; Fri, 14 Jan 2011 07:17:13 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 14 Jan 2011 07:17:12 +0100 From: Polytropon To: Robert Bonomi 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> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: awk question: replacing "%d%s" by "%d %s" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2011 06:17:16 -0000 On Thu, 13 Jan 2011 18:22:18 -0600 (CST), Robert Bonomi 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, ...