From owner-freebsd-questions@freebsd.org Mon Aug 10 01:26:58 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 F27263C1B7F for ; Mon, 10 Aug 2020 01:26:58 +0000 (UTC) (envelope-from roberthuff@rcn.com) Received: from smtp.rcn.com (smtp.rcn.com [69.168.97.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPyxG1PSjz4ZkF for ; Mon, 10 Aug 2020 01:26:57 +0000 (UTC) (envelope-from roberthuff@rcn.com) DKIM-Signature: v=1; a=rsa-sha1; d=rcn.com; s=20180516; c=relaxed/simple; q=dns/txt; i=@rcn.com; t=1597022816; h=From:Subject:Date:To:MIME-Version:Content-Type; bh=xRfGyGzz1HV/P03G3E/sUCbQfak=; b=ZOG6ZbXKE6JW455xtWp9E/+ndLedZcEoSJMqb10bJ3qzVC/tAm+bJTTpnNLzysUH Bcw8wY5po3pmn4NXfkuyAzsCrIpNLATLMEFntKkbTkMBf3YD+VKe5SBtoYOeGXjw 9N4g0QukDq2Z10zGwQp8slFfqgqTg5tfJAqw0ntgaGnIQ9VcSR2/UqolaIrP7geF xqrN5TO1RYnwLYBOJ7IV96v0aDHjILrOHjnRf1sqJNV3Cizlstp6TgjQ/8Mhf7dL /zBCE+Z7k3EQGyoVGLac44ex0kiLCX575E0yBNapYxev4Oj+jbUEfUjRnke5T6zi ZsF23HbRd8asCsnlkXGueQ==; X_CMAE_Category: , , X-CNFS-Analysis: v=2.3 cv=Z5uS40ZA c=1 sm=1 tr=0 a=9TgA2UwI6Wy+6BV4wQM/cQ==:117 a=9TgA2UwI6Wy+6BV4wQM/cQ==:17 a=KGjhK52YXX0A:10 a=kj9zAlcOel0A:10 a=XRQyMpdBKAEA:10 a=y4yBn9ojGxQA:10 a=48faUk6PgeAA:10 a=Amql5xnVCW0is45y9fIA:9 a=RRU2haG7krlYyIGl:21 a=Y3WJ1lcEbAhQ47ma:21 a=CjuIK1q_8ugA:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine X-Authed-Username: cm9iZXJ0aHVmZkByY24uY29t Received: from [209.6.230.48] ([209.6.230.48:49888] helo=jerusalem.litteratus.org.litteratus.org) by smtp.rcn.com (envelope-from ) (ecelerity 3.6.25.56547 r(Core:3.6.25.0)) with ESMTPSA (cipher=AES256-GCM-SHA384) id 39/C1-10869-062A03F5; Sun, 09 Aug 2020 21:26:56 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <24368.41568.96908.196223@jerusalem.litteratus.org> Date: Sun, 9 Aug 2020 21:26:56 -0400 From: Robert Huff To: Ernie Luzar Cc: "freebsd-questions\@freebsd.org" Subject: csh use of grep | tr commands In-Reply-To: <5F30962B.5060005@gmail.com> References: <5F30962B.5060005@gmail.com> X-Mailer: VM 8.2.0b under 26.3 (amd64-portbld-freebsd13.0) X-Rspamd-Queue-Id: 4BPyxG1PSjz4ZkF X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=rcn.com header.s=20180516 header.b=ZOG6ZbXK; dmarc=pass (policy=none) header.from=rcn.com; spf=pass (mx1.freebsd.org: domain of roberthuff@rcn.com designates 69.168.97.78 as permitted sender) smtp.mailfrom=roberthuff@rcn.com X-Spamd-Result: default: False [-5.17 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[rcn.com:s=20180516]; RWL_MAILSPIKE_POSSIBLE(0.00)[69.168.97.78:from]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:69.168.97.0/24]; NEURAL_HAM_LONG(-1.01)[-1.014]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.07)[-1.068]; DWL_DNSWL_LOW(-1.00)[rcn.com:dkim]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[rcn.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[rcn.com,none]; NEURAL_HAM_SHORT(-0.99)[-0.985]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:36271, ipnet:69.168.97.0/24, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[69.168.97.78:from] 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 01:26:59 -0000 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 > > ip=`grep "ip4=" directory-path/file-name > > $ip ends up having ip4="10.111.098.2" in it > > ip=`echo -n "${ip}" | tr -d "ip4=" > > $ip ends up having "10.111.098.2" in it > > Putting | tr """ " "` after the echo above gives error. > > How do I remove the " around the ip address? Would awk perhaps be a better tool? Respectfully, Robert Huff -- Get it right: _physical_ distancing; _social_ cohesion