I would like to use bash on a file to extract text that lies between two strings. There are already some answers to this, eg:
Print text between two strings on the same line
But I would like to do this for multiple occurrences, sometimes on the same line, sometimes on new lines. for example, starting with a file like this:
\section{The rock outcrop pools experimental system} \label{intro:rockpools}
contain pools at their summit \parencite{brendonck_pools_2010} that have weathered into the rock over time \parencite{bayly_aquatic_2011} through chemical weathering after water collecting at the rock surface \parencite{lister_microgeomorphology_1973}.
Classification depends on dimensions \parencite{twidale_gnammas_1963}.
I would like to retrieve:
brendonck_pools_2010
bayly_aquatic_2011
lister_microgeomorphology_1973
twidale_gnammas_1963
I imagine sed should be able to do this but I'm not sure where to start.
grepcommand that puts the\parencitebefore the open brace, and then filter the output withsedto remove the unwanted material.