[librecat-dev] string operations, defining functions in Catmandu

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Thu Jul 13 14:14:54 CEST 2017


With marc_copy,marc_paste you can do it also:

# Make a copy of the 100-field
marc_copy(100,f100)

# For every 100-field copy
do list(path:f100,var:c)

    # Create a 400-field structure with the required indicators and field
    # in the right order
    set_hash(f)
    add_field(f.tag, "400")
    copy_field(c.ind1, f.ind1)
    copy_field(c.ind2, f.ind2)
    copy_field(c.subfields.*.a, f.subfields.$append.a)
    copy_field(c.subfields.*.q, f.subfields.$append.q)
    copy_field(c.subfields.*.b, f.subfields.$append.b)
    copy_field(c.subfields.*.c, f.subfields.$append.c)
    copy_field(c.subfields.*.d, f.subfields.$append.d)

    # Do this for every 100-field copy
    copy_field(f,f400.$append)
end

# Paste the new 400-field into the record
marc_paste(f400)

# Add a dot at the end when required
unless marc_match(400,"\.$")
    marc_append(400,".")
end


Patrick


> On 13 Jul 2017, at 12:26, Uldis Bojars <captsolo at gmail.com> wrote:
> 
> marc_match(100aqbcd,"\.$")

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20170713/f8679c26/attachment.asc>


More information about the librecat-dev mailing list