Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ionen-angewandte-physik
AG-Wester
bibtools
Commits
541260f0
Commit
541260f0
authored
Sep 06, 2019
by
User expired
Browse files
Explicitly choose GNU AWK were necessary
This avoids unexpected failures with no or poor error messages.
parent
3bde02b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
README.md
README.md
+3
-0
bin/bib-separate
bin/bib-separate
+3
-3
bin/bib-unite
bin/bib-unite
+4
-4
No files found.
README.md
View file @
541260f0
...
...
@@ -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`
:
...
...
bin/bib-separate
View file @
541260f0
...
...
@@ -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
'
|
g
awk
-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 \
...
...
bin/bib-unite
View file @
541260f0
...
...
@@ -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
'
|
g
awk
'
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
'
|
g
awk
'
BEGIN {
RS="\n"
ORS="\n"
FS="\0"
FS="\0"
# Requires GNU AWK.
OFS="\n"
}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment