Date: Mon, 10 Aug 2020 02:57:07 -0400 From: Aryeh Friedman <aryeh.friedman@gmail.com> To: "Steve O'Hara-Smith" <steve@sohara.org> Cc: Robert Huff <roberthuff@rcn.com>, Ernie Luzar <luzar722@gmail.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: csh use of grep | tr commands Message-ID: <CAGBxaX=5v0_HQMj_%2Bubt_dgnbzw5L8DyNdHzR9k433hfkNg8mw@mail.gmail.com> In-Reply-To: <20200810074135.c76402a37676b5d2bf03b851@sohara.org> References: <5F30962B.5060005@gmail.com> <24368.41568.96908.196223@jerusalem.litteratus.org> <CAGBxaX=%2B6Lji_zDUKTvrq4Kdo%2BM1jFDjLtDpTuU_Ue1Q_VJ3AQ@mail.gmail.com> <20200810074135.c76402a37676b5d2bf03b851@sohara.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 10, 2020 at 2:41 AM Steve O'Hara-Smith <steve@sohara.org> wrote: > On Sun, 9 Aug 2020 21:35:12 -0400 > Aryeh Friedman <aryeh.friedman@gmail.com> wrote: > > > 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 > ... > > > 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. > > <fx: click>I'll just pack the perl interpreter up again then</fx> > > 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 <steve@sohara.org> > -- 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=5v0_HQMj_%2Bubt_dgnbzw5L8DyNdHzR9k433hfkNg8mw>