In your long TeX input file (your source), use \ifsecret ... \fi to sandwich the secret parts that you want to either include or exclude. The common parts will always be included so don't sandwich them.
% filename.tex
\documentclass[preview,border=12pt]{standalone}
\newif\ifsecret
\begin{document}
common 1
\ifsecret
I have a top secret message here.
\fi
common 2
\end{document}
Make a batch file as follows.
pdflatex -jobname=secret-included "\AtBeginDocument{\secrettrue} \input{filename}"
pdflatex -jobname=secret-excluded "\AtBeginDocument{\secretfalse} \input{filename}"
The following simulates your problem.
% compile with pdflatex -shell-escape
\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{filename.tex}
\documentclass[preview,border=12pt]{standalone}
\newif\ifsecret
\begin{document}
common 1
\ifsecret
I have a top secret message here.
\fi
common 2
\end{document}
\end{filecontents*}
\usepackage{graphicx}
\begin{document}
\immediate\write18{\unexpanded{pdflatex -jobname=secret-included "\AtBeginDocument{\secrettrue} \input{filename}"}}
\immediate\write18{\unexpanded{pdflatex -jobname=secret-excluded "\AtBeginDocument{\secretfalse} \input{filename}"}}
Done, secret-included.pdf and secret-excluded.pdf have been generated!
\fbox{\includegraphics[width=.5\linewidth]{secret-included}}%
\fbox{\includegraphics[width=.5\linewidth]{secret-excluded}}
\end{document}
