One thing that many people do not always realize is that MarcEdit includes a console application as part of the MarcEdit package. This is a separate program, cmarcedit.exe. The tool is designed to provide quick access to the MARCEngine functions (making/breaking) as well as character conversions, etc. Since documentation on this tool is light (something I’ll try and change this weekend) – I wanted to quickly provide some information on how to use some of the basic functions.
Before using the command-tool, I’d recommend creating an environmental variable to stand in for the path to MarcEdit. This will ensure on windows that you are not having to type the path to the MarcEdit file path each time you want to run the tool. My environmental variable is %MARCEDIT% so you’ll see that show up in my examples.
Command line options – type c:\%MARCEDIT%/cmarcedit.exe –h This will generate the following list:
***************************************************************
* MarcEdit 5.8 Console Application
* By Terry Reese
* Oregon State University
* email: terry.reese@oregonstate.edu
* Modified: 2012/10/19
***************************************************************
Arguments:
-s: Path to file to be processed.
If calling the join utility, source must be files
delimited by the ";" character
-d: Path to destination file.
If call the split utility, dest should specify a folder
where split files will be saved.
If this folder doesn’t exist, one will be created.
-mxslt: Path to the MARCXML XSLT file.
-xslt: Path to the XML XSLT file.
-batch: Specifies Batch Processing Mode
-character: Specifies character conversion mode.
-break: Specifies MarcBreaker algorithm
-make: Specifies MarcMaker algorithm
-marcxml: Specifies MARCXML algorithm
-xmlmarc: Specifics the MARCXML to MARC algorithm
-marctoxml: Specifies MARC to XML algorithm
-xmltomarc: Specifies XML to MARC algorithm
-join: Specifies join MARC File algorithm
-split: Specifies split MARC File algorithm
-records: Specifies number of records per file [used with split command].
-raw: [Optional] Turns of mnemonic processing (returns raw data)
-utf8: [Optional] Turns on UTF-8 processing
-marc8: [Optional] Turns on MARC-8 processing
-pd: [Optional] When a Malformed record is encountered, it will modify the process from a stop process to one where an error is simply noted and a stub note is added to the result file.
-help: Returns usage information
Operations:
- MarcBreaker – to replicate the MarcBreaker functionality, you need to utilize the –break switch in combination with the –s and –d. If you wish to include character encoding arguments, you’d include the –utf8 or –marc8 options as well.
Example: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.mrc” –d “c:\users\reeset\desktop\test.mrk” - MarcMaker – to replicate the MarcMaker functionality, you need to utilize the –make switch in conjunction with the –s and –d switches. If you wish to include character encoding arguments, you’d include the –utf8 or the –marc8 options as well.
Example: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.mrk” –d “c:\users\reeset\desktop\test1.mrc” - MARC2MARCXML – to replicate the ability to generate MARC to MARCXML – you would use the –marcxml switch in conjunction with the –s and –d options. You do not need to specify character conversion – MarcEdit always converts data to UTF8 when dealing with XML.
Example: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.mrc” –d “c:\users\reeset\desktop\test.xml” –marcxml - MARCXML2MARC – to replicate the ability to generate MARCXML to MARC – you will use the –xmlmarc switch in conjunction with the –s and –d options. If you wish to convert the results into MARC-8, you can include the –marc8 switch as well. MarcEdit includes two MARCXML processing algorithms. By default, it uses the native function – but you can force the application to use DOM when processing MARCXML back to MARC by including –mxslt option as well.
Example Native Function: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.xml” –d “c:\users\reeset\desktop\test2.mrc” –xmlmarcExample XSLT Function: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.xml” –d “c:\users\reeset\desktop\test2.mrc” –xmlmarc –mxslt “E:\users\reeset\marcedit\net_marcedit\C#\MProgram\MarcEdit\bin\Debug\xslt\MARCXMLSlim.xsl”
- MARC to XML format – You can convert directly to other XML formats – like MODS, using the –marctoxml option.
Example c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.mrc” –d “c:\users\reeset\desktop\test.xml” –marctoxml –xslt “E:\users\reeset\marcedit\net_marcedit\C#\MProgram\MarcEdit\bin\Debug\xslt\MARC21slim2MODS3.xsl” - * XML to MARC – You can convert directly from other XML functions like MODS back to MARC using the –xmltomarc option.
Example: c:\%MARCEDIT%\cmarcedit.exe –s “c:\users\reeset\desktop\test.xml” –d “c:\users\reeset\desktop\test3.mrc” –xmltomarc –xslt “E:\users\reeset\marcedit\net_marcedit\C#\MProgram\MarcEdit\bin\Debug\xslt\MODS2MARC21slim.xsl”
–TR
* The xml to marc switch is new as of the update posted Oct. 28, 2012.