Created
November 15, 2012 20:25
-
-
Save devd/4081033 to your computer and use it in GitHub Desktop.
LaTeX Multiple Files to One File
This file contains 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
use strict; | |
use warnings; | |
getcontent($ARGV[0]); | |
use strict; | |
use warnings; | |
sub getcontent{ | |
my $filename = shift; | |
my $line; | |
open (my $fh,"<",$filename.".tex") or die "no file named $filename"; | |
while(<$fh>){ | |
chomp; | |
$line = $_; | |
unless($line =~ m/\\input\{(.*?)\}/ig){ | |
print $line,"\n"; | |
next; | |
} | |
next if $line =~ m/^%/; | |
getcontent($1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment