Text::BibTeX -- bibgrep-like script?

M

Michael Friendly

I have a bunch of .bib files I use in writing (Ubuntu /Kile). When I
want to cite a paper, it would be quicker to have a command line utility
to grep for an author/title keyword to find the key for \cite{} than,
say to open JabRef or similar and run searches on my various .bib files,
which live in ~/texmf/bibtex/bib/.

Is there some script ready made or configurable somewhere to
use Text::BibTeX to search such a collection of files?

thanks
-Michael

PS
I did some Googling on this and found bibgrep,
http://sourceforge.net/projects/bibgrep/, but it is too old and quirky
to compile from source.
 
D

Dr Eberhard Lisse

Can't you load them into SQL with jabRef and then look them up quickly?

el
 
R

Rainer Weikusat

Dr Eberhard Lisse said:
Can't you load them into SQL with jabRef and then look them up
quickly?

FYI/ JFTR: 'SQL' is a query language used by so-called 'relational database
management systems' (depending on whom you ask, it either means
'structured query language' or is an abbreviation of the original
[IBM] name sequel).
 
M

Michael Friendly

Can't you load them into SQL with jabRef and then look them up quickly?

Thanks for the reply, but I was looking for a 'live' text-based
solution. I don't really know
how to load into SQL with jabRef, but in any case, that would entail
updating that
when the .bib files change.

FWIW, below is a perlish kludge that invokes Tom Christ's old tcgrep
script with some suitable
args in my very specific context. I was hoping to replace it with
something more
BibTeX-aware and general, perhaps based on Text::BibTeX, to be able to
search for strings in bibtex keys, authors, titles, ...

#!/usr/bin/perl
#
# bibgrep -- Prints entries in your bib file(s) that match search string.
#
# USAGE: bibgrep <string> [<files>]
#

my $home = $ENV{'HOME'};
my $tcgrep = "$home/bin/tcgrep";

# symbolic names for bib files
my (%BIBFILES) =
(
'graphics' => "$home/texmf/bibtex/bib/graphics.bib",
'statistics' => "$home/texmf/bibtex/bib/statistics.bib",
'timeref' => "$home/texmf/bibtex/bib/timeref.bib",
'Rpackages' => "$home/texmf/bibtex/bib/Rpackages.bib",
);

### Arguments

my $str = shift @ARGV;
my @files = @ARGV || values %BIBFILES;

### Main

die "USAGE: $0 <string> [<files>]\n" unless $str;
system("$tcgrep -pTia $str @files");
exit;
 
D

Dr Eberhard Lisse

Rainer,

thank you so much for your enlightening comment.

I use BibDesk on the Mac and thus have not much experience with
JabRef itself but http://jabref.sourceforge.net/help/SQLExport.php
shows you what I mean.

el

Dr Eberhard Lisse said:
Can't you load them into SQL with jabRef and then look them up
quickly?

FYI/ JFTR: 'SQL' is a query language used by so-called 'relational database
management systems' (depending on whom you ask, it either means
'structured query language' or is an abbreviation of the original
[IBM] name sequel).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top