I am writing a small text book of Problems, Electronics engineering stream, in LaTeX. It has a long list of small part files for each chapter. In this each problem is separated by LaTeX environment Prob. Apart from this problems some explanation, theorems and examples are also interspersed.
In this condition my question is how to pull out all lines between \begin{Prob} and \end{Prob} strings including these two.
\section{Vector Operations}
\begin{description}[style=multiline,leftmargin=0.25\textwidth,font=\bfseries]
\item [Negative Direction] If $\vb{A}$ is defined as shown
\item [Addition] Adding $\vb{A}$ and $\vb{B}$ is done by
\end{description}
\section{Exercises}
\begin{Prob}
Find the component of $\vb{A}$ along $\vb{B}$ in the following $\vb{A}= 10\ux-6\uy+7\uz$ and $\vb{A}= -5\ux+7\uy$ and find $3\vb{A}+2\vb{B}$.
\begin{ans}
content...
\end{ans}
\begin{sol}
The component of $\vb{A}$ along $\vb{B}$ is found by
$(\vb{A}\dotproduct \vb{B}) \frac{\vb{B}}{\abs{B}} $
and, $\vb{A}\dotproduct \vb{B} = A_xB_x+A_yB_y+A_zB_z$
If $\vb{A}= 10\ux-6\uy+7\uz$ and $\vb{A}= -5\ux+7\uy$ then $\vb{A}\dotproduct \vb{B} = 10(-5)-6.7$
\end{sol}
\end{Prob}
\begin{Prob}
Given that $L(2,3,2)$ and $M(-3,0,5)$ find
\begin{enumerate}[noitemsep,nolistsep]
\item Vector directed from Origin to $L$.
\item Unit vector along from origin to the mid point of $L$ and $M$.
\item Calculate the length of vector $\boldsymbol{LM}$.
\end{enumerate}
\begin{ans}
\begin{multicols}{3}
\begin{enumerate}[noitemsep,nolistsep]
\item $\vecty{2}{3}{2}$
\item $\big( -0.5, 1.5, 3.5 \big) $
\item $\vecty{2.5}{1.5}{-1.5}$
\end{enumerate}
\end{multicols}
\end{ans}
\begin{sol}
\begin{enumerate}[noitemsep,nolistsep]
\item \begin{align*}
\boldsymbol{LO} &= \vecty{(2-0)}{(3-0)}{(2-0)}\\
&= \vecty{2}{3}{2} \\
\end{align*}
\item Mid point of $L$ and $M$ \begin{align*}
\boldsymbol{ML} &= \Big(\frac{(2-3)}{2}, \frac{(3+0)}{2}, \frac{(2+5)}{2} \Big) \\
&= \big( -0.5, 1.5, 3.5 \big) \\
\end{align*}
\item Vector joining $L$ and $M$ is \begin{align*}
\boldsymbol{LM} &= \vecty{\frac{(2+3)}{2}}{\frac{(3-0)}{2}}{\frac{(2-5)}{2}} \\
&= \vecty{2.5}{1.5}{-1.5}
\end{align*}
\end{enumerate}
\end{sol}
\end{Prob}
Please suggest a bash script for extracting the lines. Other solutions using python etc are also welcome.