5 Display one MARC record, or extract data elements from MARC records
java -cp $JAR de.gwdg.metadataqa.marc.cli.Formatter [options] <file>
or with a bash script
./formatter [options] <file>
options:
- general parameters
-f
,--format
: the MARC output format- if not set, the output format follows the examples in the MARC21 documentation (see the example below)
xml
: the output will be MARCXML
-c <number>
,-countNr <number>
: count number of the record (e.g. 1 means the first record)-s [path=query]
,-search [path=query]
: print records matching the query. The query part is the content of the element. The path should be one of the following types:- control field tag (e.g.
001
,002
,003
) - control field position (e.g.
Leader/0
,008/1-2
) - data field (
655\$2
,655\$ind1
) - named control field position (
tag006book01
)
- control field tag (e.g.
-l <selector>
,--selector <selector>
: one or more MarcSpec or PICA Filter selectors, separated by ‘;’ (semicolon) character-w
,--withId
: the generated CSV should contain record ID as first field (default is turned off)-p <separator>
,--separator <separator>
: separator between the parts (default: TAB)-e <file>
,--fileName <file>
: the name of report the program produces (default:extracted.csv
)-A <identifiers>
,--ids <identifiers>
: a comma separated list of record identifiers
The output of displaying a single MARC record is something like this one:
LEADER 01697pam a2200433 c 4500
001 1023012219
003 DE-101
005 20160912065830.0
007 tu
008 120604s2012 gw ||||| |||| 00||||ger
015 $a14,B04$z12,N24$2dnb
016 7 $2DE-101$a1023012219
020 $a9783860124352$cPp. : EUR 19.50 (DE), EUR 20.10 (AT)$9978-3-86012-435-2
024 3 $a9783860124352
035 $a(DE-599)DNB1023012219
035 $a(OCoLC)864553265
035 $a(OCoLC)864553328
040 $a1145$bger$cDE-101$d1140
041 $ager
044 $cXA-DE-SN
082 04$81\u$a622.0943216$qDE-101$222/ger
083 7 $a620$a660$qDE-101$222sdnb
084 $a620$a660$qDE-101$2sdnb
085 $81\u$b622
085 $81\u$z2$s43216
090 $ab
110 1 $0(DE-588)4665669-8$0http://d-nb.info/gnd/4665669-8$0(DE-101)963486896$aHalsbrücke$4aut
245 00$aHalsbrücke$bzur Geschichte von Gemeinde, Bergbau und Hütten$chrsg. von der Gemeinde Halsbrücke anlässlich des Jubliäums "400 Jahre Hüttenstandort Halsbrücke". [Hrsg.: Ulrich Thiel]
264 1$a[Freiberg]$b[Techn. Univ. Bergakad.]$c2012
300 $a151 S.$bIll., Kt.$c31 cm, 1000 g
653 $a(Produktform)Hardback
653 $aGemeinde Halsbrücke
653 $aHüttengeschichte
653 $aFreiberger Bergbau
653 $a(VLB-WN)1943: Hardcover, Softcover / Sachbücher/Geschichte/Regionalgeschichte, Ländergeschichte
700 1 $0(DE-588)1113208554$0http://d-nb.info/gnd/1113208554$0(DE-101)1113208554$aThiel, Ulrich$d1955-$4edt$eHrsg.
850 $aDE-101a$aDE-101b
856 42$mB:DE-101$qapplication/pdf$uhttp://d-nb.info/1023012219/04$3Inhaltsverzeichnis
925 r $arb
An example for extracting values:
./formatter --selector "008~7-10;008~0-5" \
--defaultRecordType BOOKS \
--separator "," \
--outputDir ${OUTPUT_DIR} \
--fileName marc-history.csv \
${MARC_DIR}/*.mrc
It will put the output into ${OUTPUT_DIR}/marc-history.csv
.