Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Aug 2020 21:35:12 -0400
From:      Aryeh Friedman <aryeh.friedman@gmail.com>
To:        Robert Huff <roberthuff@rcn.com>
Cc:        Ernie Luzar <luzar722@gmail.com>,  "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: csh use of grep | tr commands
Message-ID:  <CAGBxaX=%2B6Lji_zDUKTvrq4Kdo%2BM1jFDjLtDpTuU_Ue1Q_VJ3AQ@mail.gmail.com>
In-Reply-To: <24368.41568.96908.196223@jerusalem.litteratus.org>
References:  <5F30962B.5060005@gmail.com> <24368.41568.96908.196223@jerusalem.litteratus.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 9, 2020 at 9:27 PM Robert Huff <roberthuff@rcn.com> 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
> >
> >  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?
>

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.

-- 
Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGBxaX=%2B6Lji_zDUKTvrq4Kdo%2BM1jFDjLtDpTuU_Ue1Q_VJ3AQ>