Ruby-marc

Rdocs are here: http://marc.rubyforge.org

These are some recipes for useful things you might want to do with ruby-marc. If you need a file of MARC records to work with, you can download one from here: http://www.archive.org/search.php?query=mediatype%3A%22data%22%20MARC.


Recipe: read in a large file of marc records, pull out one of them and write it to a separate file

require 'rubygems'
require 'marc'

reader = MARC::Reader.new('/usr/local/projects/bl-demo/data/lc_records.utf8.mrc')
record = reader.first
writer = MARC::Writer.new('/tmp/file2')
writer.write(record)
writer.close