Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 17:01:54 +0200
From:      Polytropon <freebsd@edvax.de>
To:        krad <kraduk@gmail.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: awk question
Message-ID:  <20151005170154.2d15b87e.freebsd@edvax.de>
In-Reply-To: <CALfReyefjMTrUW1YhPZC3n2QwPMOVZJxS8oMtgU_jo9sG%2BqgaQ@mail.gmail.com>
References:  <5611C922.4050007@hiwaay.net> <20151005042129.1f153ec6.freebsd@edvax.de> <5611F776.9090701@hiwaay.net> <56124479.9020505@sneakertech.com> <CALfReyefjMTrUW1YhPZC3n2QwPMOVZJxS8oMtgU_jo9sG%2BqgaQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 5 Oct 2015 11:00:33 +0100, krad wrote:
> Just to add to the pile, if you want to pull a section out of a file you
> can do something along the lines of this.
> 
> # for p in {a..z}; do echo $p; done | awk '/^k/,/^t/ {print $0}'
> k
> l
> m
> n
> o
> p
> q
> r
> s
> t

You can see this example in the EXAMPLES section of "man awk".
And you can omit "{ print $0 }" because that's the default
action anyway. Otherwise, your demonstration is fully valid
and a good reminder. :-)

-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151005170154.2d15b87e.freebsd>