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
d7d9f3c1
Commit
d7d9f3c1
authored
Feb 12, 2020
by
User expired
Browse files
bib-format: awk syntax revision, sub instead of gsub
parent
87409682
Pipeline
#27875
passed with stage
in 1 minute and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
bin/bib-format
bin/bib-format
+9
-9
No files found.
bin/bib-format
View file @
d7d9f3c1
...
...
@@ -189,26 +189,26 @@ do
# Remove url and eprint if doi exists.
# Otherwise, try to obtain doi from url.
{
rm
"
$tmpfile
"
&&
awk
'BEGIN{
RS
=
"@"
;
FS
=
"\n"
;
ORS
=
RS
;
OFS
=
FS
{
rm
"
$tmpfile
"
&&
awk
'BEGIN
{
RS
=
"@"
FS
=
"\n"
ORS
=
RS
OFS
=
FS
}
{
# Check if Doi is present.
if ($0 ~ "\n Doi = {.*\\..*}") {
hasdoi
=
1
hasdoi
=
1
} else {
hasdoi
=
0
hasdoi
=
0
}
# Print record separator.
if (NR > 1) { printf("%s", ORS) }
# Iterate fields.
for (i
=1;i
<=NF;i++) {
for (i
= 1; i
<=
NF;
i++) {
if (!hasdoi && ($i ~ "^ Url = .*doi.org")) {
# Use Url as Doi field.
g
sub("^ Url", " Doi", $i)
sub("^ Url", " Doi", $i)
}
if (hasdoi && ($i ~ "^ (Eprint|Url) = .*}[, ]*$")) {
# Remove Eprint and Url if Doi is present.
...
...
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