[librecat-dev] Catmandu marc questions

Lars Kolling lars.kollingl at gmail.com
Fri Sep 9 17:00:51 CEST 2016


Dear Patrick and community,

regarding the previous issue, i think the question was perl related
more, rather than catmandu itself.

How one can combine a fix with a test, out of being forced to use a
fix in a perl program.

My guess is that something like if i change tag 245, i store this
value in an array,

and then

with something like is_deeply( $got, { array => bag(qw/the values you
expect/), # and other expected values }, one can test the fix she
implemented.


The example provided by *Johann,* instead of doing the below, how one
could give as input a txt file named OldNames.csv and the replacements
be in a file named NewNames.csv?

do marc_each()
    if marc_match(100a,"OldName")
        marc_set(100a,"NewName")
    end
    if marc_match(245a,"OldTitle")
        marc_set(245a,"NewTitle")
    end
end

I know regexes work in the if marc_match, do they also work in the marc_set?

do marc_each()
    if marc_match(100a,"(Old)(N)(ame)")
        marc_set(100a,"$1G$3")



last, i do not know how to produce a clean report,
say i wanted to have a txt file with all 001 values, or a tag that is
repeatable....

i noticed

catmandu convert --fix 'retain(_id)' MARC to YAML < file_0.mrc

has an output that adds for example ' character, when we have a digit

---
_id: '120090304134844'
...
---
_id: recorda
...
---
_id: recordb
...
---
_id: recordc
...
---
_id: recorde
...
---
_id: '8797989999140813'

Is there a way to have just the values, in a row by row format?

Best
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20160909/196f5588/attachment.html>


More information about the librecat-dev mailing list