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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25299 invoked from network); 3 Sep 2021 00:08:45 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2021 00:08:45 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630627725; b=ZCRU0DrWoanecgRSZILOt+NHnz+Tbe277J93ofw+4m0LjELzhueqNn1bWCBZ1jRvKgJanPO16X bJqB/gsrYhnUdB6jXheCs4peFjlicFjO2BRqSF3vHDGSM75ND8Nmh1vlUbnUJiPnn+q/n7J1RW efoo4lkQSB3KHCAX/QyJnyqY3ORlBemd13jr3X6LfGHyeHx82QB+u12/hj+ne1Ypwrcz1OgYd2 aJDPO2FS3EEj0grHU+beuesjvylEMuoB+nIZB8VUixmjSmwXyhbqlPWfz1kRSpQxgnkSTib0fr Nndc3lroI+OGB56YbS0F1i+sZSZhECZnenZASsCZUc1eHg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f174.google.com) smtp.remote-ip=209.85.219.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630627725; bh=2cZ/4M0XDQvG7rqw5BVAoPUoLO//lf+akoxezKwfTuQ=; 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=CBS5ErTwc5N5UzVe2lWDalKY+Td/6XNokf7Qr68QUsUo/GjKURGK2EO4RPJc8lJPm6hMS8RAkm MDoA5pvcZ/E2Db9fCdB2Ux82o/ZkQwRQ57LO4BW4X9Aefdelgb5JC4p4BxWK27dQDvlrgSH3N8 UGp6dgNoViZqerNvflY3RGuVUGI1oq/tus0lHsEOwXjxUc/a/97NVoswZmkzDrCwFpjLmMadzL MM3j56H+AfIwfJPT8AO1g+v99y20ai7T836Rp+dlbCipdMPsuyTOpzOSGKZvUekr1bGr+Ux5Rr MiDP6PBkQte3F8XmyWb9eA1TLe5NpEnczghrDwlJuY+rsA==; 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=t5gcZq1PYmit3jFhK5j86G+mCS2YYAmZobbZsAT7Reg=; b=T3jTjsMFy/C8a5NS5S+aN5LNYH PHEOUebkBLGRdwWeN0nxw13e+W/C7k95n3hS7zNUnkavAFPmC/WcjDZbNhA14hI2ncYoU+uojuGiV ZaUJMwY+MKn4eDo6QhnFcng0nym5NO8cSzPE7wXoj76O5wb59NN4WaQebimadtdBxPOvudEwZTUYO /K8DZOtg0p30Jafkn4kRc+1NgI5gaXACiDwu5e+7bByCJIook6qedDEc6JyZ5Lh/tIGOaqGIYPoPe WoD2+aoTjEVkfkaEtkt1m0u/cN75Y2PoOQ3SMPMtlqFHr98BY8BcAnL/UAU2DyPA8Y+tK8l8poMnT xQJQl6zg==; Received: from authenticated user by zero.zsh.org with local id 1mLwlA-000IVE-50; Fri, 03 Sep 2021 00:08:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f174.google.com) smtp.remote-ip=209.85.219.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f174.google.com ([209.85.219.174]:35759) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLwkY-000Hoe-PH; Fri, 03 Sep 2021 00:08:08 +0000 Received: by mail-yb1-f174.google.com with SMTP id z5so7082414ybj.2 for ; Thu, 02 Sep 2021 17:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=t5gcZq1PYmit3jFhK5j86G+mCS2YYAmZobbZsAT7Reg=; b=xRYtQGW6si+cztC/iUMDiSVhorzpGeXk2/dRGVWhpQBcRXY/Ge1zulSBhrqO0OHnQI 8brkwXgR69qPI5xB3Qw6rtlin2W8ge4VE4iH21Vfgpd1mvv0SgjuPFhlUbp7p5G/9Yz8 OS6E7p2+rxLyX/wv7T/spjD8Bu2TtkxOsM98zF4Yd6dpbZ3FUxNRmkLv2+oQ1qyhTACM LEgkk8PkoLOuZvnD9ruOI23XUMXSjY4lftTIDYgoXp4HzSZYpw8HI+zS3GUkisD7tUqk 1jBU3i0chCbwMq1PEOl5c3P2KF4uDvD7lgNRFNpgvxG23Lqi7RHsZpHTgE/FKY8h0YdD sqrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=t5gcZq1PYmit3jFhK5j86G+mCS2YYAmZobbZsAT7Reg=; b=lt6d+rc68DQ4WOkDQOaXQEHO7XMcGsAi31gxMTBeeBvf59qaB8YbAbpB4n0KqCW7H8 Hp25NM8sxoeXKYEodvRWTC2m2/jCOFj+kbjNxSYIVemehHbxiOyds0yw2l0tbgaZPzE6 WKS+7sn3GmMSvzkB+puoVOfDuzJHT58y0wdJ4DBu5HIsmAe17VZbQB8P1ZqfD5C/3jfB UIt7vKktQszmQolGFh3gUypt9WkUdNM+B5lT/Z8+vLextNUv7r7rbUbE/Jh7boanHbRf glvtJ5Eq+bIxLlMKZ4a1wjA6UPJFiGg5yxLsPmJpDxNl5/yW4vqsRAF4FshqOTfoKuUR Y9mA== X-Gm-Message-State: AOAM533Pq7HvefUkpRRyapnRLv3USLcKY/Vj0sr2oMdg2B1ddunQSQUj sbANvZ95xaFnTw9IkxFcNsyeQA/0enNfJZq+1SgT4fRoZENEVw== X-Google-Smtp-Source: ABdhPJzBG/DXhHgSaZ1gIDl4fy/4Dm6eTQKN6BgehYrIy//KvC97SkcCH8QPJUdqALikqrCOa7NUSE0gJ5zAlNnxGuY= X-Received: by 2002:a25:31c5:: with SMTP id x188mr1225367ybx.291.1630627685596; Thu, 02 Sep 2021 17:08:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Thu, 2 Sep 2021 17:07:54 -0700 Message-ID: Subject: Re: autoload variables To: Roman Perepelitsa , Marc Chantreux , Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27076 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: On Thu, Sep 2, 2021 at 4:10 PM Anthony Fletcher wrote: > > > > > sed -n -e '/^default/ s/^default.*dev //; s/ .*// p;q' To start out with, if this is GNU sed, that trailing ";q" means that at most one line will be processed, and then sed will stop. So this is going to print either one or zero lines. One line will be printed if s/ .*//p matches the first line of input, otherwise nothing will be. In front of that, /^default/ means to consider lines that begin with default as candidates for s/^default.*dev// -- but lines that don't match /^default/ also won't have anything changed by that s///, so either it should move on to the s///p and then q(uit). > 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. If that's true, then you have not accurately copy-pasted your sed command in the original example. If the command were this: sed -n -e '/^default/{s/^default.*dev //; s/ .*// p;q;}' Then the braces group the expressions that are separated by semicolons, and you'll skip every line up to the first one that matches /^default/ and then apply the two s/// to that before quitting (again with exactly one or zero lines of output). In that instance the leading /^default/ matters.