Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Text::BibTeX -- bibgrep-like script?

Reply
Thread Tools

Text::BibTeX -- bibgrep-like script?

 
 
Michael Friendly
Guest
Posts: n/a
 
      03-27-2013
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.

 
Reply With Quote
 
 
 
 
Dr Eberhard Lisse
Guest
Posts: n/a
 
      03-29-2013
Can't you load them into SQL with jabRef and then look them up quickly?

el

On 2013-03-27 15:07 , Michael Friendly wrote:
> 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.
>



--
if you want to reply, replace nospam with my initials
 
Reply With Quote
 
 
 
 
Rainer Weikusat
Guest
Posts: n/a
 
      03-29-2013
Dr Eberhard Lisse <(E-Mail Removed)> writes:
> 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).
 
Reply With Quote
 
Michael Friendly
Guest
Posts: n/a
 
      03-29-2013
On 3/29/2013 9:49 AM, Dr Eberhard Lisse wrote:
> 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;
> el
>
> On 2013-03-27 15:07 , Michael Friendly wrote:
>> 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.
>>

>
>


 
Reply With Quote
 
Dr Eberhard Lisse
Guest
Posts: n/a
 
      03-30-2013
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

On 2013-03-29 15:58 , Rainer Weikusat wrote:
> Dr Eberhard Lisse <(E-Mail Removed)> writes:
>> 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).
>



--
if you want to reply, replace nospam with my initials
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments