1 |
On 2018-01-17 12:49, Adam Carter wrote: |
2 |
|
3 |
> I'm using this to grab a section of text across multiple lines, how do |
4 |
> i get it to exit after the first match? |
5 |
> |
6 |
> awk '/foo/,/bar/' |
7 |
|
8 |
I don't think I ever tried to match multiple line range. I would do it |
9 |
like this: |
10 |
|
11 |
/foo/ { selecting = 1; } |
12 |
|
13 |
( selecting == 1 ) { print $0; } |
14 |
|
15 |
/bar/ { if (selecting) exit 0; } |
16 |
|
17 |
-- |
18 |
Please don't Cc: me privately on mailing lists and Usenet, |
19 |
if you also post the followup to the list or newsgroup. |
20 |
To reply privately _only_ on Usenet, fetch the TXT record for the domain. |