From owner-freebsd-questions@freebsd.org Mon Aug 10 07:18:25 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFDDD3C7D3E for ; Mon, 10 Aug 2020 07:18:25 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQ6km272lz3cbv for ; Mon, 10 Aug 2020 07:18:24 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: by mail-il1-x12a.google.com with SMTP id y18so6709254ilp.10 for ; Mon, 10 Aug 2020 00:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vy5yFrahEpgwvFOpWBiKa7q+7sk7Kc7pok4rJohNJlI=; b=L/bG7l1Fvq9xwuwt+fCyHzkVpOPDuQQy5iIQCgUEkJfj4wCHt9ya67N4rNyEu3Ld+5 1Hotg3vn5RTlqr2S+VCy78OfL6oA3TgzNb+Sb9EoVxeFT3yyoBCtVsnDPqZHwRKFnp0a OXkm3sh5zx+NbB8U/oeE5tznCNyYErEk9AJW+JssuX82PIvYrFAq+0btOy9BVg7bes8l NW50tPGazMZP/tPUXEm8Y6AF5D3ow5VfO0TrejlOC+JK2lCHnnGazpQBqVzA2U1ouA5D nQYvFazfZUSC6TSCk3jGNyiJ3gfnNoghcmE+SB6Qwxbiqw92IwbZCBDmkBIwRq76OUJa SKOQ== 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:cc; bh=Vy5yFrahEpgwvFOpWBiKa7q+7sk7Kc7pok4rJohNJlI=; b=EqweI/DAVcqSAZ7K7nHOIpgvZnE5kArFk3mio+QkEmHcvTM664GFTiRPUCr5iWTMFu xwxwQFQgSZKtJv+yg8RZOj/NhXHMUzNcmtlTURm2Yl3ZWCl70QstbUDnajmxZdKJANNA MeLOv96RUtyqTHxVbJdtIww1R1XL8npMevWle18ut8hXENSd+kAC5ThdlH+hg64Gg+Jn YiZ153Qdxykz6nZMnw/6xkpmtIlnpp7l3Fh64bVAe1mPa+xewavc9SyqPqv7aVRT4ckG gwxRE2dTI6CriOZAua56IB1i+uG92KJgPaY7q1UZmOCrrHcd8z2eUBX3TneaHMLoZdSW 7skA== X-Gm-Message-State: AOAM533pFlfiqq15YYvd47ElfcuQR7wbUq82GIvwZviK0xjnlkHS1U72 +spc2TvILJ55gv3ogKA6hjDMYEgIM9+tS9Sm9AQ= X-Google-Smtp-Source: ABdhPJxBfMoQ7SdbhEZBYnM0kGTfpbbn5zIdsbLqMu8T8MaT4OJ8+VmBEdF607XwN0jz3zTvsp+b7fI/8pFLtFcvkhM= X-Received: by 2002:a92:cbd0:: with SMTP id s16mr8142160ilq.187.1597043903229; Mon, 10 Aug 2020 00:18:23 -0700 (PDT) MIME-Version: 1.0 References: <5F30962B.5060005@gmail.com> <24368.41568.96908.196223@jerusalem.litteratus.org> <20200810074135.c76402a37676b5d2bf03b851@sohara.org> <20200810080928.74df05790dd6676439ad750c@sohara.org> In-Reply-To: <20200810080928.74df05790dd6676439ad750c@sohara.org> From: Aryeh Friedman Date: Mon, 10 Aug 2020 03:18:12 -0400 Message-ID: Subject: Re: csh use of grep | tr commands To: "Steve O'Hara-Smith" Cc: Robert Huff , Ernie Luzar , "freebsd-questions@freebsd.org" X-Rspamd-Queue-Id: 4BQ6km272lz3cbv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=L/bG7l1F; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of aryehfriedman@gmail.com designates 2607:f8b0:4864:20::12a as permitted sender) smtp.mailfrom=aryehfriedman@gmail.com X-Spamd-Result: default: False [-3.18 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.09)[-0.088]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.07)[-1.067]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.02)[-1.022]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::12a:from]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_CC(0.00)[rcn.com,gmail.com,freebsd.org]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2020 07:18:25 -0000 On Mon, Aug 10, 2020 at 3:09 AM Steve O'Hara-Smith wrote: > On Mon, 10 Aug 2020 02:57:07 -0400 > Aryeh Friedman wrote: > > > On Mon, Aug 10, 2020 at 2:41 AM Steve O'Hara-Smith > > wrote: > > > > > Seriously though I'd go with cut. > > > > > > $ echo 'ip4="10.111.098.2"' | cut -d\" -f2 > > > 10.111.098.2 > > > > > > > Only problem doesn't handle the case where you might have multiple quoted > > values on the line where is cut -f2 -d'='|tr -d '"' does > > Agreed - but since we know it's a quoted IP address we can save a > process. > In foo: ip4_ifaces="re0:192.168.11.60" "lo0:127.0.0.1" foreach i (`grep ip4 foo|cut -f2 -d'='|tr -d '"') ifconfig `echo $i|cut -f1-2 -d':'` end > -- > Steve O'Hara-Smith | Directable Mirror Arrays > C:\>WIN | A better way to focus the sun > The computer obeys and wins. | licences available see > You lose and Bill collects. | http://www.sohara.org/ > -- Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org