Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Aug 2020 20:34:51 -0400
From:      Ernie Luzar <luzar722@gmail.com>
To:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>,  Ernie Luzar <luzar722@gmail.com>
Subject:   csh use of grep | tr  commands
Message-ID:  <5F30962B.5060005@gmail.com>

next in thread | raw e-mail | index | archive | help
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?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5F30962B.5060005>