Commit 541260f0 authored by User expired's avatar User expired
Browse files

Explicitly choose GNU AWK were necessary

This avoids unexpected failures with no or poor error messages.
parent 3bde02b2
......@@ -30,6 +30,9 @@ or build `doc/bibtools.pdf` yourself with `make doc`.
Setup
-----
GNU AWK is required. For Ubuntu you may install the `gawk` package:
sudo apt-get install gawk
Install scripts to `$HOME/bin`:
......
......@@ -49,7 +49,7 @@ do
# Write records to single files.
sed '1s/^/\n\n/;N;s/\([^\n]\)\n@/\1\n\n@/;P;D' "$bibfile" \
| awk -v src="$bibfile" -v useFile=$USEFILE -v override=$OVERRIDE '
| gawk -v src="$bibfile" -v useFile=$USEFILE -v override=$OVERRIDE '
BEGIN {
# Split at new lines preceding an "@" sign.
RS="\n\n@"
......@@ -60,12 +60,12 @@ BEGIN {
{
if ((useFile) && ($0 ~ /\<File\> += {:[^}]+:[A-Z]+}/)) {
# If exists, obtain pdf filename from JabRef style field File.
match($0, "File += {:[^}]+:[A-Z]+}", a)
match($0, "File += {:[^}]+:[A-Z]+}", a) # Requires GNU AWK.
sub("^File += {:", "", a[0])
sub(":[A-Z]+}$", "", a[0])
} else {
# If not, derive a filename from the citation key.
match($0, "[A-Za-z][^{]*{[^,]*", a)
match($0, "[A-Za-z][^{]*{[^,]*", a) # Requires GNU AWK.
sub("^[A-Za-z][^{]*{", "", a[0])
if (a[0] != "") {
cmd = sprintf("echo \"%s\" | sed -r \
......
......@@ -32,12 +32,12 @@ fi
# Concatenate and sort all files.
sed '1s/^/\n\n/;$s/$/\n@/;N;s/\([^\n]\)\n@/\1\n\n@/;P;D' "$@" \
| awk '
| gawk '
BEGIN {
RS="\n\n@"
ORS="\n"
FS="\n"
OFS="\0"
OFS="\0" # Requires GNU AWK.
}
{
# Print one line records with fields delimited by NUL.
......@@ -56,11 +56,11 @@ BEGIN {
| sort -sn -k2,2 $RYEAR \
| sort -sf -k1,1 \
| sed 's/^[^\x00]*\x00\x00/\x00/' \
| awk '
| gawk '
BEGIN {
RS="\n"
ORS="\n"
FS="\0"
FS="\0" # Requires GNU AWK.
OFS="\n"
}
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment