[Tex/LaTex] Is it possible to input a file while lowering every section it has by 1 level

sectioningsubfiles

Assume that I want to add a part of a paper I've wrote into a different document.

Inside the new document, the part of the paper should be only a section, so every section of the paper would become a subsection, and every subsection should become a subsubsection.

For example, assume I have the document:

\documentclass{article}
\begin{document}
   \section{Doc A}
   \input{docA}
   \section{Conclusions}
   Very good.
\end{document}

While docA.tex has:

\section{Hello}
This should actually be a subsection.
\subsection{World}
And that one is a subsubsction.

When compiling the document I get:

enter image description here

How do I make every section/subsection in the input file go one level lower, such that the Hello would become Subsection 1.1, and World will then be Subsubsection 1.1.1 (i.e., there should only be 2 sections in the outer doc)?


Obviously, this can be done by modifying docA, but I prefer not to change it if possible.

Best Answer

\documentclass{article}
\begin{document}
   \section{Doc A}
   {
\let\section\subsection
\let\subsection\subsubsection
\input{docA}
}
   \section{Conclusions}
   Very good.
\end{document}