#!/usr/bin/perl -s undef $/; while($x = <>){ $_.=$x; } #@ele = map {s/\}\{(\s|\n)*/\n/;$_} m/\\addthe\{(.*?\}\{.*?)\n\}/gs; #@ele = m/\\addthe\{(.*?\}\{.*?)\n\}/gs; @ele = map {s/\s*\}\{(\s|\n)*/\n/;$_} m/\\addthe\{\s*(.*?\}\{.*?)\n\}/gs; @eleRef = map {$n++; "$_\nref ~ pg. \\pageref{THESAURUS:$n}; "} m/\\tindex\{\s*(.*?)\}/gs; $base='/dev/null' unless (-e $base); print `cat $base`, "\n\n", join("\n\n",@ele),"\n\n",join("\n\n",@eleRef) ; __END__ =head1 NAME getalladdthe - extrai \addthe{nome}{descrição} de um texto LaTeX e constroi um =head1 SYNOPSIS getalladdthe -base=inicioDoThesaurus f.tex > thesaurus =head1 DESCRIPTION C extrai os comandos C<\addthe{nome}{descrição}> de um texto LaTeX e constroi um thesaurus iso com essa informação.