I had to remove all the comments from a LaTeX file.
LaTeX comments start with ‘
%‘. It was enough to remove comments that start at the beginning of a line.
cat file.tex | grep -v ^%
(Yeah, I know, it’s two processes, but I prefer like this…)
If your comments start with ‘
#‘, use “
cat file | grep -v ^#“.