diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /biblio/bibtex/utils/misc/bibfind |
Initial commit
Diffstat (limited to 'biblio/bibtex/utils/misc/bibfind')
-rw-r--r-- | biblio/bibtex/utils/misc/bibfind | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/biblio/bibtex/utils/misc/bibfind b/biblio/bibtex/utils/misc/bibfind new file mode 100644 index 0000000000..f2ac1a3760 --- /dev/null +++ b/biblio/bibtex/utils/misc/bibfind @@ -0,0 +1,38 @@ +#!/usr/bin/perl +# +# bibfind -- Prints entries in your bib file that match search string. +# +# USAGE: bibfind <string> [<file>] +# +# Note: +# Place bibfind in ~/bin, then chmod +x bibfind, then edit bibfind to change +# the default bib file (see the variable $bibfile on line 29). +# +# 2001-07-05, Oyvind.Breivik@dnmi.no +# + +### Arguments + + my ($str,$file) = @ARGV; + +### Locals + + my @paragraphs; + my $home; + my $bibfile; + +### Main + + die "USAGE: $0 <string> [<file>]\n" if $#ARGV < 0; + $/ = ''; # $INPUT_RECORD_SEPARATOR set to read paragraphs + $home = $ENV{"HOME"}; + $bibfile = "$home/dok/tex/bibtex/Breivik.bib"; # Default bibtex file + $file = $bibfile if ($#ARGV < 1); + + open(FILE, $file) or die "ERROR: Can't open $file"; + print "$file\n"; + @paragraphs = <FILE>; # Slurp up file by paragraph + + foreach (@paragraphs) { + print if /$str/i; # Case ignored, if wanted, remove trailing i. + } |