On Wed, Jan 17, 2018 at 6:16 PM, Alexander Kapshuk < alexander.kaps...@gmail.com> wrote:
> On Wed, Jan 17, 2018 at 3:49 AM, Adam Carter <adamcart...@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!