Skip to content
Bruce D'Arcus edited this page Jul 11, 2022 · 8 revisions

If you have one very large bibliography file that changes a lot, consider splitting it in two, perhaps with a script like this, which automatically moves content from a small to a large file once small reaches a certain size. You can run it as a cron script.

#!/bin/bash

# large, changes less frequently
BIG=library.bib
# small, changes more frequently
SMALL=new.bib

# size of small before script actually does anything
MAXSIZE=5000

# get file size
FILESIZE=$(stat -c%s "$SMALL")

if ((FILESIZE > MAXSIZE)); then
    # when $SMALL exceeds $MAXSIZE, move its content to $BIG
    cat "$SMALL" >> "$BIG"
    echo "" > "$SMALL"
fi

This will ensure the large file is ideally only parsed once per session, and the small file, which parses much quicker, as needed.

Clone this wiki locally