<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><pre>Hello,<br></pre><pre><br>How could i alter the following fix, in order to get a report, that would have as output, <br><br></pre><pre>for each value found in the csv, all ids of the mrc it is found?<br><br></pre><pre>The below fix, prints for each id, the values it has from the name value csv file...<br></pre><pre><br>The CVS file looks like:
test.csv:
name,value
DLC,DLC
OCLC,OCLC
This fix file generates a report on all the MARC tags that have the $c subfield matching the CVS file:
test.fix:
do marc_each()
copy_field(record.0.0,<a href="http://test.name" target="_blank">test.nam<wbr>e</a>)
marc_map(***c,test.value)
lookup(test.value,test.csv,del<wbr>ete:1)
if exists(test.value)
copy_field(test,found.$append)
end
remove_field(test)
end
remove_field(record)
Run it as:
$ catmandu convert MARC to YAML --fix test.fix < camel.usmarc <br><br></pre><pre>The result produced, is <br><br>---<br>_id: '39'<br>found:<br>- name: '611'<br> value: heritage<br>- name: '613'<br> value: subject<br>- name: '620'<br> value: iged<br>- name: '680'<br> value: geo<br><br><br></pre><pre>How one can have an output like below?<br><br></pre><pre>something like for each value found in the csv,<br><br></pre><pre>print all ids it is found:<br></pre><pre>---<br>value : heritage<br></pre><pre>name : '611'</pre></div>
</div><pre>_id: '39'<br><br>name : '611'
_id: '140'<br><br>---<br>value : subject<br>name : '611'
_id: '39'<br><br>name : '611'
_id: '785'<br><br>---<br>...<br></pre><pre>Thank you very much<br></pre></div>