From owner-freebsd-hackers@freebsd.org Fri Nov 6 18:28:59 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9AA5A27F8B for ; Fri, 6 Nov 2015 18:28:59 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A9353128D for ; Fri, 6 Nov 2015 18:28:59 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id A6D59A27F8A; Fri, 6 Nov 2015 18:28:59 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5795A27F89 for ; Fri, 6 Nov 2015 18:28:59 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [IPv6:2a00:1450:400c:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 374C5128B; Fri, 6 Nov 2015 18:28:59 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: by wikq8 with SMTP id q8so35528691wik.1; Fri, 06 Nov 2015 10:28:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=j1Rhui6I/PjJhzFVh5yicgtmr0WpR2FRGyiSh54rLwY=; b=HvSd4AGmliyWiJwvoZ6jc4iSPu581dl2OLcekNVNoCedUukR3zJI3BGws8VkjchT9V F6eHQfNF82wb4t0sGOH7kBlp7EZTzssgtP9++n2AWQFV5xG3oyHmMCl3bQfKc1OkTXy0 HG/tQkbjFP2KFSvLlX3LmOrUBcn4mjyJzPu2OB/1UEdbbKskrl3Px2X80I2GvUVBDISe XxuBbKh6DQlUNrAFZnM8WXElxNhv0z8tHx0WdVWZY5pXZORzPCqV6eY9m61uwDqvJaow 3JdXy6tDF1e0x1VpOzYWRwzh5bjFKUVI8BkMYajzUU0paasoA8aMA+IxJHDEPIedIavr wUUA== X-Received: by 10.194.187.14 with SMTP id fo14mr16532102wjc.104.1446834537644; Fri, 06 Nov 2015 10:28:57 -0800 (PST) Received: from localhost (78-1-136-48.adsl.net.t-com.hr. [78.1.136.48]) by smtp.gmail.com with ESMTPSA id q1sm1307813wjy.31.2015.11.06.10.28.56 (version=SSLv3 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Nov 2015 10:28:57 -0800 (PST) Date: Fri, 6 Nov 2015 19:28:53 +0100 From: To: hackers@freebsd.org Cc: "Ian Lepore" , "Chris H" Subject: Re: awk's curly braces (regex) Message-ID: <20151106192853.00005e57@gmail.com> In-Reply-To: <3605b86a5de658159efd2e014a75b0e1@ultimatedns.net> References: <20151104211008.00006c16@gmail.com> <1446670398.91534.358.camel@freebsd.org> <3605b86a5de658159efd2e014a75b0e1@ultimatedns.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2015 18:29:00 -0000 On Wed, 04 Nov 2015 19:36:29 -0800 "Chris H" wrote: > On Wed, 04 Nov 2015 13:53:18 -0700 Ian Lepore wrote > > > On Wed, 2015-11-04 at 21:10 +0100, rank1seeker@gmail.com wrote: > > > 10.2-RELEASE-p6 > > > > > > # awk --version > > > awk version 20121220 (FreeBSD) > > > > > > # echo 2015 | awk '/^[0-9]/ {print}' > > > Prints '2015' > > > > > > # echo 2015 | awk '/^[0-9]{4}/ {print}' > > > Won't > > > > > > Why range/interval specified via curly braces doesn't work. > > > PS: Yes I've tried escaping it with backslahes and double > > > backslahes, nada! > > > > > > man pages: > > > -- > > > Regular expressions are as in egrep; see grep(1). > > > -- > Your SHELL can be a "gatcha", as well. I know my shell. Soner or later it always ends up in script => /bin/sh > > > > For what it's worth, the manpage on a linux system I checked also > > says the regex is like egrep, but then it points out that one > > difference is "interval expressions" (curly brace stuff) which it > > says are "likely to break old awk programs" so they're only enabled > > if --posix or --re -interval options are given. Our awk doesn't > > seem to support those options. > > > > I guess our awk might also avoid the interval expressions out of > > caution for breaking old programs; maybe we need to add the options > > to enable them, like gnu awk has. > > > > -- Ian Then, mentioned part of man pages has been blindly pasted. awk's curly braces don't work as regex in FreeBSD, nor can it be enabled. Here is a proof that regex curly part is matched literally: # echo '2015{40}' | awk '/^[0-9]+{40}/ {print}' 2015{40} You devs decide best solution for awk, but for start, you can edit man pages at least. Thx, Domagoj