From owner-freebsd-questions@freebsd.org Mon Oct 5 10:00:35 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 B4C859B1C1E for ; Mon, 5 Oct 2015 10:00:35 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [IPv6:2a00:1450:400c:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 612AAE1C for ; Mon, 5 Oct 2015 10:00:35 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: by wiclk2 with SMTP id lk2so106694356wic.1 for ; Mon, 05 Oct 2015 03:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=H0G2y80ZDWPXCKY5paYzSlcAryFoLsigj+3pAOGUEtA=; b=n9Esh/zres7bUTgm5aiU4rdLTb3O/1UlB6/szWnQt6yi5vKTkc48PQKmWU/uLNcbA9 c2quiFRmgL0zJx2YYww0eGOPQt43xbaTCEnxRZCh6VAX875Dve5KNWYgKR3BgJPP7YSg eJzC1aNYHZacBaaUNhnJGye3C1oYm+6Hj0tr8t9Lr09UwNlYKM6XTzRrAPFFgZKghThw H947mB2Gix+AkvidDSQFDBfoW7cH1/cMm6FFrD5V6MpbbtFpOJl1mgfiX7/qHBz1mUyC 0TK0BH5DoLybsYJiodVVbj1IAwl5dTea1+8qQspi1WmT23iNr4rAjrXqaKmpOp4LTKf9 Xh/w== MIME-Version: 1.0 X-Received: by 10.180.206.45 with SMTP id ll13mr10166719wic.6.1444039233883; Mon, 05 Oct 2015 03:00:33 -0700 (PDT) Received: by 10.28.125.18 with HTTP; Mon, 5 Oct 2015 03:00:33 -0700 (PDT) In-Reply-To: <56124479.9020505@sneakertech.com> References: <5611C922.4050007@hiwaay.net> <20151005042129.1f153ec6.freebsd@edvax.de> <5611F776.9090701@hiwaay.net> <56124479.9020505@sneakertech.com> Date: Mon, 5 Oct 2015 11:00:33 +0100 Message-ID: Subject: Re: awk question From: krad To: Quartz Cc: FreeBSD Questions Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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 10:00:35 -0000 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 On 5 October 2015 at 10:35, Quartz wrote: > Funny you mention grep, I had a similar conversation on the NetBSD list >> last week & everyone there suggested using awk alone to 'grep' out the >> lines I wanted. >> > > Awk, sed, and various other utilities all have basic regex line matching, > so if you're already calling them for some other feature then piping the > output through grep first is kinda silly and inefficient. It's sorta like > doing $(cat foo.txt | grep 'bar') instead of just $(grep 'bar' foo.txt). I > suggested it mainly because it's easy to understand conceptually and > because awk's syntax has something of a steep learning curve. > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >