From owner-freebsd-questions@freebsd.org Tue Aug 11 14:52:12 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 2166E3B0125 for ; Tue, 11 Aug 2020 14:52:12 +0000 (UTC) (envelope-from kremels@kreme.com) Received: from mail.covisp.net (mail.covisp.net [65.121.55.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQwlv2Wk1z4c1X for ; Tue, 11 Aug 2020 14:52:10 +0000 (UTC) (envelope-from kremels@kreme.com) From: "@lbutlr" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: csh use of grep | tr commands Date: Tue, 11 Aug 2020 08:52:08 -0600 References: <5F30962B.5060005@gmail.com> <20200810164453.378835aa.freebsd@edvax.de> To: FreeBSD In-Reply-To: <20200810164453.378835aa.freebsd@edvax.de> Message-Id: X-Mailer: Apple Mail (2.3652.0.5.2.1) X-Rspamd-Queue-Id: 4BQwlv2Wk1z4c1X X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of kremels@kreme.com designates 65.121.55.42 as permitted sender) smtp.mailfrom=kremels@kreme.com X-Spamd-Result: default: False [-0.17 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.80)[-0.804]; FROM_HAS_DN(0.00)[]; MISSING_MIME_VERSION(2.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; DMARC_NA(0.00)[kreme.com]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.94)[-0.942]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.02)[-0.024]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:65.112.0.0/12, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[65.121.55.42: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: Tue, 11 Aug 2020 14:52:12 -0000 On 10 Aug 2020, at 08:44, Polytropon wrote: > On Sun, 09 Aug 2020 20:34:51 -0400, Ernie Luzar wrote: >> Double quotes are giving me trouble. >>=20 >> I have a file with a line in it like this >> ip4=3D"10.111.098.2" >> I want to get just the ip address >>=20 >> ip=3D`grep "ip4=3D" directory-path/file-name >>=20 >> $ip ends up having ip4=3D"10.111.098.2" in it >>=20 >> ip=3D`echo -n "${ip}" | tr -d "ip4=3D" >>=20 >> $ip ends up having "10.111.098.2" in it >>=20 >> Putting | tr """ " "` after the echo above gives error. >>=20 >> How do I remove the " around the ip address? >=20 > Without any insult: You're using the wrong tool. >=20 > While the C shell is acceptable as an interactive shell > (and I even prefer it over bash to a certain degree), > it's absolutely terrible, and I may even say unsuited > for scripting. I agree. My first use of a unix system defaulted to csh. As soon as I = started writing scripts I switched away from csh. (bash and now zsh). > The system's default scripting shell is sh. Use that. Or that. > % echo 'those "are" quotes' | sed 's/"//g' Exactly what I would do, though I sometimes I use egrep -o if there is = longer input. --=20 I WILL NOT SELL LAND IN FLORIDA Bart chalkboard Ep. 7F16