From: Adam Carter <adamcarter3@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] OT awk question
Date: Fri, 19 Jan 2018 09:13:12 +1100 [thread overview]
Message-ID: <CAC=wYCGPy0PgJOXxYqewoExM4cLjxy7UNODtOKwt=qtVQazHEw@mail.gmail.com> (raw)
In-Reply-To: <CAJ1xhMUWMYzGFwBvNeZcuJBM+qo9Qeb84z-dvBP5v9xS+GA_6Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
On Wed, Jan 17, 2018 at 6:16 PM, Alexander Kapshuk <
alexander.kapshuk@gmail.com> wrote:
> 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
>
> The awk line works. I didnt try the sed line. Thanks!
[-- Attachment #2: Type: text/html, Size: 952 bytes --]
next prev parent reply other threads:[~2018-01-18 22:13 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 ` [gentoo-user] " Alexander Kapshuk
2018-01-18 22:13 ` Adam Carter [this message]
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='CAC=wYCGPy0PgJOXxYqewoExM4cLjxy7UNODtOKwt=qtVQazHEw@mail.gmail.com' \
--to=adamcarter3@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