From owner-freebsd-questions@freebsd.org Mon Oct 5 15:01:56 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A77C19B171F for ; Mon, 5 Oct 2015 15:01:56 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C51BB85 for ; Mon, 5 Oct 2015 15:01:56 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-13-98.dynamic.qsc.de [92.195.13.98]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 7684D277EC; Mon, 5 Oct 2015 17:01:54 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t95F1su6008904; Mon, 5 Oct 2015 17:01:54 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Mon, 5 Oct 2015 17:01:54 +0200 From: Polytropon To: krad Cc: FreeBSD Questions Subject: Re: awk question Message-Id: <20151005170154.2d15b87e.freebsd@edvax.de> In-Reply-To: References: <5611C922.4050007@hiwaay.net> <20151005042129.1f153ec6.freebsd@edvax.de> <5611F776.9090701@hiwaay.net> <56124479.9020505@sneakertech.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2015 15:01:56 -0000 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, ...