Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Searching BiBTeX

by Meshach (Initiate)
on Jul 22, 2002 at 15:46 UTC ( #184102=perlquestion: print w/ replies, xml ) Need Help??
Meshach has asked for the wisdom of the Perl Monks concerning the following question:

I have a file of BibTeX entries. Each one looks something like this:

@ARTICLE{klitzing:nobel, AUTHOR="Klaus von Klitzing", TITLE="The Quantized Hall Effect", JOURNAL=RMP, VOLUME=58, PAGES=519, YEAR=1986 }
I need to run a search on the entries that will result in all the compleate entries matching the paramaters being in their own file. I know how to use files and grep, what I was wondering was what the best way of finding out what entry you're in is.

The problem with grep is that it just returns the matching line, which doesn't do me much good at all.

I could store each entry in an array and search it, but that seems very wasteful, so I'm trying to avoid that aproach.

Thanks in advance.
Good day, Meshach

Comment on Searching BiBTeX
Download Code
Re: Searching BiBTeX
by Abigail-II (Bishop) on Jul 22, 2002 at 16:32 UTC
    If each entry is just like this, that is, terminated with \n}\n, you could just set $/ to \n}\n, read in the records one by one and print if there's a match.

    If the BiBTeX file is a bit more of a mess, you will have to parse the file. Text::Balanced might help you, or Parse::RecDescent, depending on how exactly the file looks like.

    Abigail

Re: Searching BiBTeX
by arturo (Vicar) on Jul 22, 2002 at 20:15 UTC

    What you seek appears to be available in Text::BibTeX ... darn I love CPAN =)

    I mistrust all systematizers and avoid them. The will to a system shows a lack of integrity -- F. Nietzsche

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://184102]
Approved by VSarkiss
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-09-19 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (140 votes), past polls