Archive

Posts Tagged ‘comments’

Remove comments from a LaTeX file

June 13, 2011 Leave a comment

Problem
I had to remove all the comments from a LaTeX file.

Solution
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…)

Generalization
If your comments start with ‘#‘, use “cat file | grep -v ^#“.

Categories: bash, latex Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 42 other followers