[librecat-dev] Writing values in fixed fields with marc_add

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Fri Jun 30 08:48:11 CEST 2017


Ah, for instance you can do this fix:

$ cat test.fix
marc_add('008', '_', '170125s????||||gw |||||ob||||||| 0|ger|d')
marc_set('008/7-10',$.date.0)
$ catmandu convert JSON to MARC --fix test.fix < data.json

Patrick
________________________________________
From: Schihin Oliver <Oliver.Schihin at zhbluzern.ch>
Sent: Thursday, June 29, 2017 4:47 PM
To: Patrick Hochstenbach
Cc: librecat-dev at lists.uni-bielefeld.de
Subject: AW: [librecat-dev] Writing values in fixed fields with marc_add

Hi

But this only works if the input is MARC and you already have a fixed field to do a marc_set on. I do
---
$cat data.json
{
   "creator" : [
      "Material-Archiv"
   ],
   "_id" : "oai:materialarchiv.ch:material/1912",
   "_about" : [],
   "date" : ["2013"]
}]

$catmandu convert JSON to MARC --fix 'marc_add('008', ' ', 'thewholestringfor008' < data.json

How would I be able to put the value of date into the 008?

Oliver

---------------------------------------------------------
KANTON LUZERN
Zentral- & Hochschulbibliothek Luzern

Oliver Schihin
Leiter Informatik

Standort Sempacherstrasse
Sempacherstrasse 10
Postfach 4469
6002 Luzern / Switzerland
---------------------------------------------------------
oliver.schihin at zhbluzern.ch
Tel: ++41 41 349 75 31
---------------------------------------------------------
www.zhbluzern.ch
---------------------------------------------------------

-----Ursprüngliche Nachricht-----
Von: Patrick Hochstenbach [mailto:Patrick.Hochstenbach at UGent.be]
Gesendet: Donnerstag, 29. Juni 2017 16:31
An: Schihin Oliver <Oliver.Schihin at zhbluzern.ch>
Cc: librecat-dev at lists.uni-bielefeld.de
Betreff: Re: [librecat-dev] Writing values in fixed fields with marc_add

Hi

marc_set should work:

$ catmandu convert MARC to MARC --type MARCMaker < camel.mrc | grep '=008'
=008  000107s2000\\\\nyua\\\\\\\\\\001\0\eng\\
=008  000203s2000\\\\mau\\\\\\\\\\\001\0\eng\\
=008  000318s1999\\\\cau\\\\\\b\\\\001\0\eng\\
=008  000318s1999\\\\caua\\\\\\\\\\001\0\eng\\
=008  000518s2000\\\\mau\\\\\\\\\\\001\0\eng\\
=008  000612s2000\\\\mau\\\\\\\\\\\100\0\eng\\
=008  000612s2000\\\\mau\\\\\\\\\\\000\0\eng\\
=008  000614s2000\\\\mau\\\\\\\\\\\000\0\eng\\
=008  000315s1999\\\\njua\\\\\\\\\\001\0\eng\\
=008  000630s2000\\\\cau\\\\\\\\\\\001\0\eng\\

$ cat test.fix
set_field(date,1971)
marc_set(008/7-11,$.date)
$ catmandu convert MARC to MARC --type MARCMaker --fix test.fix < camel.mrc | grep '=008'
=008  000107s1971\\\nyua\\\\\\\\\\001\0\eng\\
=008  000203s1971\\\mau\\\\\\\\\\\001\0\eng\\
=008  000318s1971\\\cau\\\\\\b\\\\001\0\eng\\
=008  000318s1971\\\caua\\\\\\\\\\001\0\eng\\
=008  000518s1971\\\mau\\\\\\\\\\\001\0\eng\\
=008  000612s1971\\\mau\\\\\\\\\\\100\0\eng\\
=008  000612s1971\\\mau\\\\\\\\\\\000\0\eng\\
=008  000614s1971\\\mau\\\\\\\\\\\000\0\eng\\
=008  000315s1971\\\njua\\\\\\\\\\001\0\eng\\
=008  000630s1971\\\cau\\\\\\\\\\\001\0\eng\\

I use Catmandu::MARC 1.14 for this.

I’m preparing now a Catmandu::MARC 1.15 for a new release which will give you marc_append(MARC_PATH,VALUE) and marc_replace_all(MARC_PATH,REGEX,VALUE)

Cheers
Patrick

> On 29 Jun 2017, at 15:26, Schihin Oliver <Oliver.Schihin at zhbluzern.ch> wrote:
>
> marc_set(‘008/7-11’, $.date)




More information about the librecat-dev mailing list