From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 15 22:02:21 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B01B1065676 for ; Fri, 15 Jan 2010 22:02:21 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-pz0-f185.google.com (mail-pz0-f185.google.com [209.85.222.185]) by mx1.freebsd.org (Postfix) with ESMTP id 4EFDA8FC18 for ; Fri, 15 Jan 2010 22:02:21 +0000 (UTC) Received: by pzk15 with SMTP id 15so884709pzk.3 for ; Fri, 15 Jan 2010 14:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kDqwE/tbpH6/JicGdtQOWCD/pwP3MPs9KszlScIIkDc=; b=YSDSTpYNFYQNLJMgULrX+kjmkTTQO8LRTWe01Yjxu7oU1bEH033EDWGJnuZKtdlREh 2BadJ3hPtBOZRDroySdBP9xitmq0/ZYpgOdUSD20xg5/Auw6EtHIvbrxjjnCwUfUjuQ9 Bnrdml/ls6xOCajSEzjeEMzdorvfGiJdFIVto= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=C0RNgTPXlNpLN0MC6/TNs1HvVIEf2OfPJ+fFTaJ7n99nuQK1cqpqk6Ep27awgj1+zc Skqwob9ub5ckWldGUDjyQnUerUY6zuOGWbOQ1uROf/Sml6CLbVH6JgIp3yPwkDw/rVrH DVVNN3EpvJCz5rhlYG+bRIqRRWcLB7jRZaVMI= MIME-Version: 1.0 Received: by 10.143.21.42 with SMTP id y42mr1999870wfi.207.1263592938935; Fri, 15 Jan 2010 14:02:18 -0800 (PST) In-Reply-To: <20100115215701.GN86359@bunrab.catwhisker.org> References: <7d6fde3d1001151241tfeaa4a2j1c8448e40b2b164e@mail.gmail.com> <20100115211639.GM86359@bunrab.catwhisker.org> <7d6fde3d1001151351u58ee4989m41d39538469de236@mail.gmail.com> <20100115215701.GN86359@bunrab.catwhisker.org> Date: Fri, 15 Jan 2010 14:02:18 -0800 Message-ID: <7d6fde3d1001151402m74d999e5off14be9a99b5d187@mail.gmail.com> From: Garrett Cooper To: David Wolfskill Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD-Hackers Subject: Re: User error or awk bug? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 22:02:21 -0000 On Fri, Jan 15, 2010 at 1:57 PM, David Wolfskill wro= te: > On Fri, Jan 15, 2010 at 01:51:34PM -0800, Garrett Cooper wrote: >> ... >> > >> > d254(6.4-S)[7] echo //////// | awk '{ gsub (/\/{2,}/, ""); print }' >> > //////// >> > d254(6.4-S)[8] echo //////// | awk '{ gsub (/\/+/, "/"); print }' >> > / >> > d254(6.4-S)[9] >> >> =A0 =A0 I'm avoiding this because it would create an infinite loop in my >> awk script (I want to squish slashes, not eliminate them completely >> :)...). > > Errr... =A0I thought "/\/{2,}/" was a regex referring to "2 or more > consecutive /", and the replacement was "", which sounds about as close > to eliminating them completely as I can imagine. =A0:-} > > How about: > > d254(6.4-S)[10] echo //////// | awk '{ gsub (/\/\/+/, "/"); print }' > / > d254(6.4-S)[11] > > then? This works very well. Is the expression quantifier operator [ `{' ] not supported in awk like perl, python, tcl, etc? Thanks, -Garrett