I am trying to match number at the end of the line ($), print relevant paragraphs and ignore third paragraph. Here is data:
this is first paragraph
number 200
with some text
this is second paragraph
with some text
number 200
this is third paragraph
with some text
number 2001
This command matches only first paragraph:
awk -v RS="" -v ORS="\n\n" "/number 200\n/" file
This command matches only second paragraph:
awk -v RS="" -v ORS="\n\n" "/number 200$/" file
Seems the problem is that awk understands character "$" as end of record instead of line. Is there some elegant way how to overcome this? Unfortunately I do not have grep that can work with paragraphs.
UPDATE:
Expected output:
this is first paragraph
number 200
with some text
this is second paragraph
with some text
number 200