## read the .bib database and extract the cited out
open my $fh2, '<', $bib_filename;
foreach $item (@citeditems){
match($item);
}
sub match{
my $reg = @_;
LINE: while(my $line = <$fh2>){
if ($line =~ m/$reg\,/ .. $line =~ /^\}$/){
print $line;
#last;
}
}
}
**** OUTPUT *******
$ ./bibextract.pl sample.tex
@Article{ dehydron1,
title = "",
author = "G. E. and A. Wedemann",
journal = PEPT,
pages = "128-127",
volume = "2",
number = "9",
month = "Jul",
year = "2001"
}
It supposed to be
****************************
@Article{ dehydron,
author = "L. F. Benoit and A. B. C",
title = "",
year = "2011",
journal = JPCHEMB,
volume = "15",
number = "2",
pages = "247-156",
doi = "10.1/jp65985"
}
@Article{ dehydron1,
title = "",
author = "G. E. and A. Wedemann",
journal = PEPT,
pages = "128-127",
volume = "2",
number = "9",
month = "Jul",
year = "2001"
}
@Article{ inhibitorAromaticDirect,
title = "",
author = "J. Hardy and D. J. Selkoe",
journal = SCIEN,
pages = "35-56",
volume = "29",
number = "580",
month = "Jul",
year = "2030"
}
******************************
not only the middle one,
do you think I should re-open the file every time in match,
Thanks again with best regards,
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/