From owner-freebsd-questions@freebsd.org Mon Aug 10 06:57:20 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 DC7753C7624 for ; Mon, 10 Aug 2020 06:57:20 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 4BQ6GS0GyNz3b5f for ; Mon, 10 Aug 2020 06:57:19 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: by mail-io1-xd44.google.com with SMTP id t15so7817463iob.3 for ; Sun, 09 Aug 2020 23:57:19 -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=m8Q5AMQL4leWsig58VFnEJRIoF4wzvsGKOBRYmWuRks=; b=uLDcsiPs5Jb4YXrVi7WVMtJBj+NYesZhFqD1wVpYKUeAprc/LaFv3z7aIHJVHeHsmg f0EYvAe8TPgrsOfbrcABEJwM0qUJmrLFZcahwVq4szDUi/ha0tEkHe27RDDXIrTL/aks wOtTy/uzbginxggGAjSlXpnHwvKsSqjIuh0Q7BDoymmvkOpPymnI0tvYRU0QM0BrMPbZ 6megCwhQHou3sCOQ1mQ2TkNJ2TFosXzWYrs+eiP7rtKyOnNtMz9+z8yQwOVarjuOg0mF EH+c2j8FPpxKkJBah4EGxDEvie2hTIP95ZbSvJwMVstCMSANh0Pfqn3asQcVRydIiahx b/Bg== 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=m8Q5AMQL4leWsig58VFnEJRIoF4wzvsGKOBRYmWuRks=; b=d24SztDIPM01ediwOPzOnKgTOwewgw5QDVdGlqchiXvL6Y3FtcjB50p1afSJ2TcBjk gjzfbuuYOY6tiN5n7sPYxFMwSp6ekpvqLav3SghYKTzemQPNwYYNbn3sdf+F26NvXCh3 UOR10l27R5/RN+dyojiEm1nT5RvIPnq7IrrStuzhsnMMhuZenWW8YIYYQol3i7szreIg zZo1QmJyAhRlPMcwRqja8AMdaYnhkz71jcKNXvwhd6CWAGNIhEdK4XzV8wuUKNnWIGFZ s0GByh7groFe/psJFI1xHxIKTR2wFhBxeLziL2MrdCRdIloz8cqI8k/RJb2otxvdiiRB CsLA== X-Gm-Message-State: AOAM533j7SAzva/8/8vi9qT9j11HUphbm7a4agEcMgnu2cYJLii/7nRL uhi3dwLTgTL+TPuFtlTpaLMGJR7JzjyNQn0neTU= X-Google-Smtp-Source: ABdhPJzMOOFh9uRIXe2/qY81dn2hYK8+AUuOUkon2TmwBab+TuF3TL77o+/5MRwWDtaHRwU3jeJXrvkvngur9sb5F8o= X-Received: by 2002:a6b:9289:: with SMTP id u131mr761667iod.89.1597042638866; Sun, 09 Aug 2020 23:57:18 -0700 (PDT) MIME-Version: 1.0 References: <5F30962B.5060005@gmail.com> <24368.41568.96908.196223@jerusalem.litteratus.org> <20200810074135.c76402a37676b5d2bf03b851@sohara.org> In-Reply-To: <20200810074135.c76402a37676b5d2bf03b851@sohara.org> From: Aryeh Friedman Date: Mon, 10 Aug 2020 02:57:07 -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: 4BQ6GS0GyNz3b5f X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=uLDcsiPs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of aryehfriedman@gmail.com designates 2607:f8b0:4864:20::d44 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.094]; 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.021]; 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::d44: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 06:57:20 -0000 On Mon, Aug 10, 2020 at 2:41 AM Steve O'Hara-Smith wrote: > On Sun, 9 Aug 2020 21:35:12 -0400 > Aryeh Friedman wrote: > > > On Sun, Aug 9, 2020 at 9:27 PM Robert Huff wrote: > > > > > Ernie Luzar writes: > > > > > > > Double quotes are giving me trouble. > > > > > > > > I have a file with a line in it like this > > > > ip4="10.111.098.2" > > > > I want to get just the ip address > ... > > > Would awk perhaps be a better tool? > > > > > > > Complete overkill for what he wants to do. > > > > He wants to bang a nail in thus only needs a hammer he does not need a > > nail gun for only one nail. > > I'll just pack the perl interpreter up again then > > 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 > > -- > Steve O'Hara-Smith > -- Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org