I am new to LaTeX. I want to create study guides/books for preparation of my maths exams. But I need to create Flashcards as well (in Anki etc.). So what I want is to be able to extract from my long tex document specific subsections called "Questions and Answers". For example, if we have:
\documentclass[10pt]{article}
\title{Italy}
\author{ahmedfarrag17}
\begin{document}
\section{Introduction}
Italy is a country consisting of a peninsula delimited by the Alps and
several islands surrounding it. Italy is located in the center of the
Mediterranean Sea, in Southern Europe, and is also often considered
part of Western Europe. A unitary parliamentary republic with Rome as
its capital and largest city, the country covers a total area of
301,340 km2.
\subsection{Questions and Answers}
Where is Italy located?\Italy is located in the center of the
Mediterranean Sea, in Southern Europe.
What is the capital of Italy?\Rome.
\section{Borders and Population}
Italy shares land borders with France, Switzerland, Austria and
Slovenia. Its population is about 60 million people.
\subsection{Questions and Answers}
Which countries share a border with Italy?
\France, Switzerland, Austria and Slovenia.
\end{document}
I want to obtain a new Tex file like this:
\subsection{Questions and Answers}
Where is Italy located?\\Italy is located in the center of the Mediterranean Sea, in Southern Europe.
\subsection{Questions and Answers}
Which countries share a border with Italy?
\France, Switzerland, Austria and Slovenia.
that has only that Questions and Answers subsection (including the text underneath of course).
How to do it? (I am new to LaTeX so I need a very simple explanation please :) ) Thank you!

\documentclass) example showing as best you can what you have to work with and what you are trying to extract? – Steven B. Segletes Jul 27 '21 at 18:37