Text::BibTeX -- bibgrep-like script?

Discussion in 'Perl Misc' started by Michael Friendly, Mar 27, 2013.

  1. 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.
     
    Michael Friendly, Mar 27, 2013
    #1
    1. Advertising

  2. 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
     
    Dr Eberhard Lisse, Mar 29, 2013
    #2
    1. Advertising

  3. Dr Eberhard Lisse <> 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).
     
    Rainer Weikusat, Mar 29, 2013
    #3
  4. 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.
    >>

    >
    >
     
    Michael Friendly, Mar 29, 2013
    #4
  5. 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 <> 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
     
    Dr Eberhard Lisse, Mar 30, 2013
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. XHTML BibTeX

    , Sep 23, 2005, in forum: XML
    Replies:
    1
    Views:
    469
    Peter Flynn
    Sep 23, 2005
  2. Alex Olivas

    compiling python-bibtex

    Alex Olivas, Dec 15, 2003, in forum: Python
    Replies:
    2
    Views:
    404
    Fernando Perez
    Dec 16, 2003
  3. Replies:
    4
    Views:
    485
    Jules Dubois
    Jul 7, 2005
  4. Rob Cowie

    Creating BibTex files with XdkBibTeX

    Rob Cowie, Sep 11, 2005, in forum: Python
    Replies:
    1
    Views:
    408
    Fernando Perez
    Sep 12, 2005
  5. Alan G Isaac

    bibtex parsing

    Alan G Isaac, Oct 17, 2008, in forum: Python
    Replies:
    4
    Views:
    303
    Paul McGuire
    Oct 18, 2008
Loading...

Share This Page