Hi,
I want to output the result into the file shared the same basename but
different extensions,
Below is what I have come up so far:
perl try.tex
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib";
my $bib_abbrev_filename ="/home/lina/texmf/bibtex/bib/biophyabbrev.bib"
open my $bib_abbrev, '<', $bib_abbrev_filename
my $bib_output, '>', "basename($ARGV[0]).bib"
### here the ARGV[0] is try.tex, so the output filename is try.bib.
my %dict;
my $tex_filename = $ARGV[0] ;
open my $file, '<', $tex_filename or die "Can't open $tex_filename:$!";
while (my $line = <$file>) {
if($line =~ m/cite\{(\S+)\}/g) {
print $1,"\n";
}
}
Thanks for your time,
Best regards,
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/