Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTYWS-00059e-O1 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 00:57:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTYWR-0001ZS-6N for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 00:57:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTYWQ-0001ZJ-TP for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 00:57:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTYWO-0002Ul-KT for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 00:57:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2810vM9B222939; Wed, 31 Aug 2022 20:57:22 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org cc: Noah Misch , hofstetter@jomasoft.ch Subject: Re: Solaris "sed" versus pre-v13 plpython tests In-reply-to: <165561.1661984701@sss.pgh.pa.us> References: <165561.1661984701@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 31 Aug 2022 18:25:01 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <222937.1661993842.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 31 Aug 2022 20:57:22 -0400 Message-ID: <222938.1661993842@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > I confirmed on the gcc farm's Solaris 11 box that the pattern > doesn't work as expected with /usr/bin/sed: > tgl@gcc-solaris11:~$ echo except foo, bar: | sed -e 's/except \([[:alpha= :]][[:alpha:].]*\), *\([[:alpha:]][[:alpha:]]*\):/except \1 as \2:/g' > except foo, bar: > We could perhaps do this instead: > $ echo except foo, bar: | sed -e '/^ *except.*,.*: *$/s/, / as /g' > except foo as bar: > It's a little bit more brittle, but Python doesn't allow any other > commands on the same line does it? Oh ... after a bit more experimentation, there's an easier way. Apparently the real problem is that Solaris' sed doesn't handle [[:alpha:]] (I wonder if this is locale-dependent?). I get correct results after expanding it manually, eg tgl@gcc-solaris11:~$ echo except foo, bar: | sed -e 's/except \([a-z][a-z.= ]*\), *\([a-z][a-zA-Z]*\):/except \1 as \2:/g' except foo as bar: We aren't likely to need anything beyond a-zA-Z and maybe 0-9, so I'll go fix it that way. regards, tom lane