Created
November 5, 2014 20:32
-
-
Save qlkzy/ca9d16e1ecb2a4c8428b to your computer and use it in GitHub Desktop.
Crude LaTeX wordcounter with ignoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| my $wc = 0; | |
| my @ignore = ('Abstract'); | |
| my $ig_pat = join '|', @ignore; | |
| while (<>) { | |
| /\\section\*?{(?:$ig_pat)}/ .. /\\section\*?{(?!:$ig_pat)}/ && next; | |
| /\\begin{lstlisting}/ .. /\\end{lstlisting}/ && next; | |
| $wc += scalar split /\s+/; | |
| } | |
| print "Words: $wc\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment