On 12-03-04 04:24 AM, lina wrote:
#!/usr/bin/env perl

use strict;
use warnings;
use File::Spec;

use File::Basename;


my $INPUTFILE = $ARGV[0];
my $tex_filename = $INPUTFILE;

my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib";
my $bib_abbrev_filename ="/home/lina/texmf/bibtex/bib/biophyabbrev.bib";

# divide the input file name into its path and name,
# ignore its extension

my ($name, $path) = fileparse($tex_filename, qr/\.[^\.]+$/);


# create a new name with .bib extension
my $output_bib_filename = File::Spec->catfile($path,"name.bib");

open my $bib_output, '>', $output_bib_filename
        or die "Could not open $output_bib_filename:$!\n";

open my $texfile, '<', $tex_filename or die "Can't open ${tex_filename}:$!";

while (my $line =<$texfile>) {
        if( $line =~ m/cite\{(\S+)\}/g) {
                my $match_entry = $1 ;
                print $match_entry,"\n";
        }
}


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

It's Mutual Aid, not fierce competition, that's the dominate
force of evolution.  Of course, anyone who has worked in
open source already knows this.

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to