Created
December 12, 2017 10:53
-
-
Save eoldavix/498629fc837a8725a1b4638b903c07f5 to your computer and use it in GitHub Desktop.
Get last multiline occurrence in a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| tac < test.xml | sed '/<\/food>/,$!d;/<food/q' | tac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <breakfast_menu> | |
| <food one> | |
| <name>Belgian Waffles</name> | |
| <price>$5.95</price> | |
| <description>Two of our famous Belgian Waffles with plenty of real maple syrup</description> | |
| <calories>650</calories> | |
| </food> | |
| <food other> | |
| <name>Strawberry Belgian Waffles</name> | |
| <price>$7.95</price> | |
| <description>Light Belgian waffles covered with strawberries and whipped cream</description> | |
| <calories>900</calories> | |
| </food> | |
| <food any> | |
| <name>Berry-Berry Belgian Waffles</name> | |
| <price>$8.95</price> | |
| <description>Light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> | |
| <calories>900</calories> | |
| </food> | |
| <food some> | |
| <name>French Toast</name> | |
| <price>$4.50</price> | |
| <description>Thick slices made from our homemade sourdough bread</description> | |
| <calories>600</calories> | |
| </food> | |
| <!-- I want this part --> | |
| <food whatever> | |
| <name>Homestyle Breakfast</name> | |
| <price>$6.95</price> | |
| <description>Two eggs, bacon or sausage, toast, and our ever-popular hash browns</description> | |
| <calories>950</calories> | |
| </food> | |
| <!-- I want this part --> | |
| </breakfast_menu> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment