From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id ACD6D277DC for ; Mon, 12 Feb 2024 18:12:52 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1707757972; b=YbM29E0/XKxrQQY5ql6ceZiz1nD9PN7MPi+hYin10ydkjkShNUedYsZSA4WoLtcSIQjMQ4Z1sp F5T0M2qUL2kvFKQJD3+2oZ9JptFPWl9DKDBU0frvY+JpMhQlp0qOYrmauyW1/kdDhK/WDyMw+s HBBIZ7j5kJhiwca0bxMKvZDbsRO0BxJizivXu+j9MOFUqSgWmWj/4LaiE6KAI5d2vpvAmYdvBM PzwYRPCdAGGHpzZR8OlZ9pZeBQYCamdyo77VfdLHbzRyiWZuZ8WPEXeTWty5S9SeZY3IT04gpk i7d095k9wn3AEG1YqTY1PWn0eXwOqKS5/6HgXri9iyCjIQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1707757972; bh=IC0TmBcbpMVMDWzX/hbq05qVj410Ja/Pa8tSqapOY8M=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=J5EGkonY2+ZvAtkweQL8App+dzlshxmBQaPbLfH9cVx/rk73zezMyCbH9k7JFRkg4a9fV48Zef sROPtKUdS5T/G3E4qpeNaWKySNwq0ySJrGaxYiKthTgs9WendPf2kDe2OO0xADnak8EK0jONWn ps4H5VlXHChq6ltIH1Jf5fk/qPujUejQg4ryQ5T9jbB923qvQ0el2qlmK9jcjvH7b17LRiLUgO X71pWa1jwfY/n1YoHk4R84NiXu5PZPDHWA4AbbyX7jFcyF2RuRVWuI5UngNcywQfTwh4Q569ZM 5BDqpqIJ6ea9XfGamJCNnJyrb0hFad9X32aI8/XvHI+9wg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7qYAxXtRfwJsq9pMfOzmib9KFbTYbMuUMuN7qMlB/4M=; b=f5avl2F4Rzmm4C5m4QM57Cif4X B5IB0tMfcaU91+fVez9li2P+9U5pQvjV206dqOnvpP4AO92jSt9fIrgRIl6X+XK+wPybeZyr8AJbs zoZhxiQ5T+RSPXhC7coGWdx6Wo9TU/u9ldQNhT/XBS9c4LgMxUna2+rPbnle1BGmoSNLjU5pdUP3b CXjasz7cicOoEceujPAJ5WQycn+F1ECibh8dKKPq9kMoP+NayJwiJ8zYS4K+VAHKlpTgYslBJWBOW SOfnfjRSU6gaxmTo7JLZ0Bt3yz403gHD8wTX5MmVaWWIoa6x5XuNX7sr5Lu9Hu12d7zrc21rCL0Q3 glpfyLvg==; Received: by zero.zsh.org with local id 1rZZrQ-000Kpu-7k; Mon, 12 Feb 2024 17:12:52 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:58819) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rZZqf-000K7v-Q1; Mon, 12 Feb 2024 17:12:06 +0000 Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2cf3ed3b917so44014821fa.1 for ; Mon, 12 Feb 2024 09:12:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707757924; x=1708362724; darn=zsh.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=7qYAxXtRfwJsq9pMfOzmib9KFbTYbMuUMuN7qMlB/4M=; b=PE7v2T/86wmhgrBEKastGOxLqcOANH74xj13a8T7Edz9pQd9gi43DCrWrcf3el8bef y6OboU4XitoU9Ip/tsUZpOwglOFTcOgeG5jRvFqu0edatpqp/r6LZHDg5tzUkSkI3vjx YQ/e2SyaeIdFlwGNmBEW+89Q+lbC9xc/46HDEacwae5Kaja0Ndb/Nv4yRz7xfg/uGhIs ySfgDfOfyF5AFTKc5IP7Q517IVUirryvalP0UAWNeNjZ3c0a0NxZvAd56dx9M5s0WLE+ qwGeS6HSSCtQ17I2G+V3w6ouIyySR1CCzrKpksdR1lhU/KNJtXjJ/6BJV8bdPZomh2uP 7btg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707757924; x=1708362724; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7qYAxXtRfwJsq9pMfOzmib9KFbTYbMuUMuN7qMlB/4M=; b=q6fgnxwNwMBTMaZQJW27hTGF9FTiNR6pC3cw00IJsTJofmL/UPxbB3VU2mHLpYE1L5 wTznm3/1TxTabavl7BH3Nw9yxagk3pcYzbg18VZfEx1ZLdW0nrrA2oWjmZQo9UE2UNec 0947kUMX2p39/RQclNlTthl+Hw6npAYz3jJaVZ56Z+J2BjrDxUpERmN/p2Hljk2iXHfU m5JnI2uEQaQvOVzE1F1bi7u2uxH13Co6dJMTYUUAkwO5EGcrjQviNkw45evwwuV0OrDB 7WN6SYTQVTR6GldleO9+8NblbAnB7lKs5sQ+r8a2M/xvi7wE3QvXMdAIBbfFrIQqoEbu VqgA== X-Gm-Message-State: AOJu0Ywm0V4yh6nTkxs7SC6atHGqT9OIlSqzwxroLY0bfZrib9dNSiJc WzDXh42uoCWWEryBQIr7nKIWFKd/i5RTA38/BeLHvcrBmu6zzCHKNKxc66M4jeYCs+X8a6674dz pPr2SZPB2jKd4epQ3+OGDiL/CR8biIkYDCbo= X-Google-Smtp-Source: AGHT+IHhSKjHB83dXcwT3Ae8+tUqeuGY7Oh8UWtXsxRJkq+j5/Ot3YczOSeJG2bwUZxFzaNn4E6AqP1GH7RIRK3SLMM= X-Received: by 2002:a2e:a238:0:b0:2d0:a037:b93d with SMTP id i24-20020a2ea238000000b002d0a037b93dmr5141945ljm.41.1707757924193; Mon, 12 Feb 2024 09:12:04 -0800 (PST) MIME-Version: 1.0 References: <49716226-f212-491a-94d9-cfdb83b38aab@bashsupport.com> In-Reply-To: From: "Mark J. Reed" Date: Mon, 12 Feb 2024 12:11:52 -0500 Message-ID: Subject: Re: Is ":G" of ${name:s/l/r/:G} actually supported? To: Zsh Users Content-Type: multipart/alternative; boundary="0000000000006f17a706113260e8" X-Seq: 29661 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --0000000000006f17a706113260e8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Well, that was a shorter reply than I intended. But you should be able to see that the section you linked (14.1.4 Modifiers) is part of 14.1, History Expansion. Those modifiers don't apply to parameter substitution. For doing replacements with parameter expansion, you can just use the slash modifier. One / replaces the first occurrence, two //s does all of them: *$ value=3D/dir/subdir/file.csv* *$ echo ${value//dir/_G}* */_G/sub_G/file.csv* That's not a zsh-specific feature; ksh and bash have it as well. Zsh likely has a different mechanism to accomplish the same thing, but I've not needed it so am not familiar with it. -- Mark J. Reed On Mon, Feb 12, 2024 at 12:02 Mark J. Reed wrote: > That's history substitution, not parameter expansion: > > > *$ ls foobar* > *...* > *$ !!:s/o/e/:G* > *ls feebar* > > > > On Mon, Feb 12, 2024 at 9:19=E2=80=AFAM Joachim Ansorg > wrote: > >> Hi, >> I was reading about modifiers on page >> https://zsh.sourceforge.io/Doc/Release/Expansion.html#Modifiers, which >> says: >> >> > The forms =E2=80=98gs/l/r=E2=80=99 and =E2=80=98s/l/r/:G=E2=80=99 pe= rform global substitution, i.e. >> substitute every occurrence of r for l. Note that the g or :G must appea= r >> in exactly the position shown. >> >> But zsh 5.9 doesn't seem to support this: >> > value=3D"/dir/subdir/file.csv" >> > echo ${value:s/dir/_/:G} >> zsh: unrecognized modifier `G' >> >> Is ":G" actually supported or is the documentation outdated here? >> I might be overlooking something very simple, though. >> >> Thank you! >> Joachim Ansorg >> -- >> BashSupport Pro >> https://www.bashsupport.com/ >> >> > > -- > Mark J. Reed > --0000000000006f17a706113260e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Well, that was a shorter reply than I in= tended. But you should be able to see that the section you linked (14.1.4 M= odifiers) is part of 14.1, History Expansion. Those modifiers don't app= ly to parameter substitution.

For doi= ng replacements with parameter=C2=A0expansion, you can just use the slash m= odifier. One / replaces the first occurrence, two //s does all of them:

$ value=3D/dir/subdir/file.csv
$ echo ${value//dir/_G}
/_G/sub_G/file.csv
=C2=A0
That's not a zsh-specific feature;= ksh and bash have it as well. Zsh likely has a different mechanism to acco= mplish the same thing, but I've not needed it so am not familiar with i= t.
--
Mark J. Reed <markjreed@gmail.com&= gt;


On Mon, Feb 12, 2024 at 12:02 Mark J. Reed= <markjreed@gma= il.com> wrote:
That's history substitution, not parameter expan= sion:

$ ls foobar
...=
$ !!:s/o/e/:G
ls feebar


On Mon, Feb 12, 2024 at 9:19=E2=80= =AFAM Joachim Ansorg <mail@bashsupport.com> wrote:
Hi,
I was reading about modifiers on page
https://zsh.sourceforge.io/Doc/Releas= e/Expansion.html#Modifiers, which says:

>=C2=A0 =C2=A0The forms =E2=80=98gs/l/r=E2=80=99 and =E2=80=98s/l/r/:G= =E2=80=99 perform global substitution, i.e. substitute every occurrence of = r for l. Note that the g or :G must appear in exactly the position shown.
But zsh 5.9 doesn't seem to support this:
=C2=A0 > value=3D"/dir/subdir/file.csv"
=C2=A0 > echo ${value:s/dir/_/:G}
=C2=A0 zsh: unrecognized modifier `G'

Is ":G" actually supported or is the documentation outdated here?=
I might be overlooking something very simple, though.

Thank you!
Joachim Ansorg
--
BashSupport Pro
https://www.bashsupport.com/



--
Ma= rk J. Reed <mar= kjreed@gmail.com>
--0000000000006f17a706113260e8--