From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6072 invoked from network); 3 Sep 2021 06:53:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2021 06:53:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630652015; b=ApzmvJ3PtAJvm3nEWKWhd43HkMvENTRE8gfeVres+NATe9HJjT9PfTlM8saBLxmI6/IcHo5CaE IA54b+4x95PWzBPBMn7xIyYZOof+pBOO33ADmp0C82sftQfj/4DPPq2n1v6ysoyi+eU2U6pZC0 kIRZRHFXbHhu9h2pdZ1Ic8ysDu/eKQk06E2uiZW/yOGfc260O1AvSdN1dHby4lI6wSVE7oy6x9 LvyWuv56oAkt0eoLMjvnew5rD1eqmbVzObX9gYlqJlHHybKjZ3bHvOXx6Z5Ba5o6D5eVl6+szz 0uUnuLmPBmAhJ35CyPW/ipAQtAErT7TDQAehKLNhPhv0xQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630652015; bh=yYJaBq4QoOJUFy59Ubjs1R/8vkNVQHW5FxxMJiWXbtA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature: DKIM-Signature; b=TC2kzgvqmyhNUb/ecVpZb35ipGN/WQS7Ax13TsVb+y8nS3WcMqFATc6TUIHN0nmiQ9mHnJVVR/ iFdGFJWiWbn5ozKMthXnbMovoYV4AhVl7vQXRApScMmjSJmiTMU4PhzD1E/rpcH7zK5nRX8pd4 USYpevjaLstobhBtZvErRrSENwYgI6dqYZGM3EJru0KoMnu2d30oweAmK6GHAgppRIt9oE/E0f rYlrvEP6p8oLJ01QkRWogsfQgpSg/lvuIackBTDTLPEThpgUPoshGhrXM4RHTjTe9ORWcaZd2H 31zPUUbX7kdRGHCnLtJbTOFHOTyn/UgIh+IWajvT4jms8g==; 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:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=t1YErrcICA2o+3brBcH6wzho4TAVI3LYKgowUU1lxbk=; b=IfrDdiIs0kALNobWg3qYeRMVOj QQFPNvalrY5kV/OTPX3qA8AreEOlRKfy5hYjS2tNKuNdPAKWct20KLZN/GeQHVRwCcP8m6rH65Bva MVT9V9Io3O6c7IiuuHvQeh1NwxPkzbBzDHnwwO6S1Ab9uDPlk70PLVnb/QZHCoc4C8+vmorDfDkgm RVsDp/sK3DnFmKVFr2vLAna0/VSrjMOYe/XwjFSvSBzPxxDfYFvHHIaYm0WnEi/Auz/Ub9uscdY9V EZM9rmnwpL4fGT+KIqGNVWU5vk6TP/mcxll62K4wMkK806IY45+iqYRcnSfUoSmweYzfAqMUY/MRN zrDF7+Cw==; Received: from authenticated user by zero.zsh.org with local id 1mM34w-000BnN-GP; Fri, 03 Sep 2021 06:53:34 +0000 Authentication-Results: zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none Received: from aurora-borealis.phear.org ([188.42.45.194]:48420) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mM341-000B4R-Dy; Fri, 03 Sep 2021 06:52:37 +0000 Received: from localhost (unknown [127.0.0.1]) by aurora-borealis.phear.org (Postfix) with ESMTP id EB1EF1049D; Fri, 3 Sep 2021 06:52:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at phear.org Received: from aurora-borealis.phear.org ([127.0.0.1]) by localhost (mail.phear.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id raYnwYzJLhTL; Fri, 3 Sep 2021 06:52:32 +0000 (UTC) Received: from prometheus.u-strasbg.fr (82-65-50-238.subs.proxad.net [82.65.50.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: khatar) by aurora-borealis.phear.org (Postfix) with ESMTPSA id B2E531049C; Fri, 3 Sep 2021 06:52:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org B2E531049C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1630651951; bh=yYJaBq4QoOJUFy59Ubjs1R/8vkNVQHW5FxxMJiWXbtA=; h=Date:From:To:Subject:References:In-Reply-To:From; b=QgX0/7C7CUVbVoCMREll2hnrXGDz6ZttAi1dlI/AcInBfO4rXbeibN62SRdS382kz YTs4ZFN88THfg+KzMPZOZDX819ycbHzSUM3AUwXNvC5XDPFjUvxEB2+0xXAOp3+2II YixqX5/2u8BMy2W7s6Yy7zEEASl7ESyJyT/MLuTpDoHsVxFTYhDb1W3PqLs2voU0rS hXvFN6zWZhqyktAOhcWfDSEuC8WrXxqFMJZIBu17w9pU9eMMzxVBqFhv+cgULRO8WG +5Vymi1E9jHcn3KtLx3mXP6EVjfhrJF2QuCMXhddYQk91jAiERqqSZOld4Kx0MVhtR 0UbPpNYVVpK7g== Date: Fri, 3 Sep 2021 08:52:24 +0200 From: Marc Chantreux To: Roman Perepelitsa , Zsh Users Subject: Re: autoload variables Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Seq: 27078 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: > > > Le Tue, Aug 31, 2021 at 11:03:39PM +0200, Roman Perepelitsa a écrit : > > > english is fine. can you confirm that '/^default/ s/^default.*dev //' > > > is a suttered way to say 's/^default.*dev //' ? > > > > Yes, these are equivalent. Anything that matches '^default.*dev ' > > matches '^default'. > > Yes but the point is I am only interested in lines that start with > 'default via'. I am ignoring all the other lines. Without the initial > match /^default/ all the other lines are processed by the > substitutions and I get the wrong interface. there is no point of repeating yourself without leaving the lhs part empty. What you just wrote is * find default at the begin of the line * find it *again then let's substitute something containing default if you wanted to ignore a line, your sed script miss the d command (i used it in the version i proposed): /^default/d stop the processing of this line (including the default p ending) if it match. /^default/!d stop the processing of this line (including the default p ending) if *don't* match. also: sed keeps the track of its last match which can be called with an empty lhs. so: /^default.*dev/!d ; s/// means: * don't process the lines that don't match the pattern * as it matched, remove the matched part > > This requires a new-enough version of ip to support json output. > Cool - I didn't know JSON output was an option. Not that jq is much less > baroque than sed. I think this is better than my sed script. * sed is for text. * jq is for datastructures serialized in json (i wish there will be a cbor backend at some point). > One point in favour of sed - it's then on all systems, jq isn't. sed is made to be a simple tool inside a pipe or from an editor: it completes an ecosystem. jq is a good query langage (baroque as well) but just for json. > Sorry for the off-topic discussion. this is my "fault" as i was the one who asked for your sed command. To me this isn't off-topic at all: zsh is about gluing commands and sed is both powerful and popular enough so any zsh user should know a bit of sed. regards marc