public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
To: Gentoo mailing list <gentoo-user@lists.gentoo.org>
Subject: Re: [gentoo-user] OT awk question
Date: Wed, 17 Jan 2018 09:16:54 +0200	[thread overview]
Message-ID: <CAJ1xhMUWMYzGFwBvNeZcuJBM+qo9Qeb84z-dvBP5v9xS+GA_6Q@mail.gmail.com> (raw)
In-Reply-To: <CAC=wYCE-whpv5Kkic8VqL85FCLHGK5sih7eE4ZKFxO9goa9GBw@mail.gmail.com>

On Wed, Jan 17, 2018 at 3:49 AM, Adam Carter <adamcarter3@gmail.com> wrote:
> I'm using this to grab a section of text across multiple lines, how do i get
> it to exit after the first match?
>
> awk '/foo/,/bar/'

See if this works for you:
awk '/foo/,/bar/{print;if(/bar/)exit}' file
sed '/foo/,/bar/!d;/bar/q' file


  parent reply	other threads:[~2018-01-17  7:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  1:49 [gentoo-user] OT awk question Adam Carter
2018-01-17  3:19 ` [gentoo-user] " Ian Zimmerman
2018-01-17  7:16 ` Alexander Kapshuk [this message]
2018-01-18 22:13   ` [gentoo-user] " Adam Carter
2018-01-19  4:20     ` Alexander Kapshuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ1xhMUWMYzGFwBvNeZcuJBM+qo9Qeb84z-dvBP5v9xS+GA_6Q@mail.gmail.com \
    --to=alexander.kapshuk@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox