catmandu - LibreCat command line tools
catmandu [-I path] [-L path] [COMMAND] [-?hqv] [long options...] [ARGS] catmandu help # convert catmandu convert JSON to YAML < file.json catmandu convert YAML to JSON < file.yaml catmandu convert YAML < file.yaml # 'to JSON' is implicit catmandu convert MARC < records.mrc catmandu convert MARC --fix 'marc_map(245,title)' < records.mrc catmandu convert OAI --url https://biblio.ugent.be/oai catmandu convert SRU --base http://www.unicat.be/sru --query dna # import catmandu import JSON to MongoDB --database_name mydb < records.json catmandu import MARC to MongoDB --database_name mydb < records.mrc catmandu import MARC to ElasticSearch --index_name mydb < records.mrc catmandu import MARC to ElasticSearch --index_name mydb --fix 'marc_map("245a","title")' < records.mrc # export catmandu export MongoDB --database_name mydb --bag data to JSON catmandu export MongoDB --database_name mydb --bag data to JSON --fix 'retain_field("_id")' catmandu export Solr --url http://localhost:8983/solr to JSON catmandu export ElasticSearch --index_name mydb to JSON # configuration $ cat catmandu.yml --- store: test1: package: MongoDB options: database_name: mydb catmandu import JSON to test1 < records.json catmandu config # show the contents of catmandu.yml catmandu count test1 catmandu delete test1 -q 'title:"My Rabbit"'
Documentation about command line options.
Display the contents of the catmandu.yml files in your project.
Convert data from one format to another format with help of Catmandu::Importers and Catmandu::Exporters. All options given on the command line will be send to the Importer or Exporter as initialization parameters. E.g.
catmandu convert OAI --url BASEURL --metadataPrefx PREFIX \ to \ CSV --header 1 --sep_char '|'
Look at the documentation of all the importers and exporters to see which options are available.
All importers accept one or more --fix options with the name of a fix file or file command.
catmandu convert JSON --fix fixes.txt catmandu convert JSON --fix 'remove_field(abc)'
The JSON exporter is implicit and is optional.
catmandu convert YAML to JSON catmandu convert YAML # shorter
Count the number of items in a Catmandu::Store. All options given on the command line will be send to the store as initialization parameters. E.g.
catmandu count MongoDB --database_name mydb --bag data
Delete items from a Catmandu::Store. All options given on the command line will be send to the store as initialization parameters. Optionally a QUERY can be provided to select the items to delete. E.g.
catmandu delete MongoDB --database_name mydb --bag data -q "title:Delete me"
Export items from a Catmandu::Store using a Catmandu::Exporter. All options given on the command line will be send to the Store or Exporter as initialization parameters. Optionally a QUERY and LIMIT can be provided to selectively export items from the Store. Optionally a FIX can be provided to be executed on all the items before they are exporter by the exporter.
E.g.
catmandu export MongoDB --database_name mydb --bag data -q "title:Perl"
Import items from a Catmandu::Importer to a Catmandu::Store. All options given on the command line will be send to the Importer or Store as initialization parameters. Optionally a FIX can be provided to be executed on all the items before they are stored into the Store.
catmandu import JSON to MongoDB --database_name mydb < records.json
Move items from one Catmandu::Store to another. All options given on the command line will be send to the Stores as initialization parameters. Optionally a QUERY and LIMIT can be provided to selectively export items from the Store. Optionally a FIX can be provided to be executed on all the items before they are stored.
Low level data manipulation command. See DATA OPTIONS below for full documentation.
Verbose output.
Specifies Perl library include paths, like perl's -I option. This option is repeatable.
Search upwards from this path for configuration files and accompanying lib directories. This option is repeatable.
These low level options are available to the "catmandu data" command.
Read items from a Catmandu::Store such as: DBI, MongoDB, Solr, ElasticSearch, ...
Read items from a Catmandu::Importer such as: YAML, JSON, CSV, MARC, OAI ...
This option should be used in combination with a --from-store. Select from the Store only the items belonging to the bag BAG_NAME.
To include configuration options to a Catmandu::Store or Catmandu::Importer an argument with prefix '--from-' can be used. E.g. to provide an 'file' to an Importer use:
--from-file /my/path/to/file.txt
Add each item read into a Catmandu::Exporter such as: JSON, YAML, Template, XLS, ...
Add each item read into a Catmandu::Store such as: DBI, MongoDB, Solr, ElasticSearch, ...
This option should be used in combination with a --into-store. Add each item into the Store with bag BAG_NAME.
To include configuration options to a Catmandu::Store or Catmandu::Exporter an argument with prefix '--into-' can be used. E.g. to provide an 'file' to an Exporter use:
--into-file /tmp/file.txt
When exporting or storing apply a fix EXPRESSION or all the fixes in FILE on each item. This option is repeatable.
When exporting or storing data skip the first NUM items.
When exporting of storing data process only a total NUM of items.
When storing data first delete all the items in the Store or Bag.
When a Store is searchable execute and return the results. Using the --cql-query or -q option the CQL query language can be used (if supported).
Limit the number of results returned from the searchable results to NUM.
Report the number of items processed.
Catmandu::Importer Catmandu::Exporter Catmandu::Store Catmandu::MARC Catmandu::OAI Catmandu::MongoDB Catmandu::Solr Catmandu::ElasticSearch
To install Catmandu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu
CPAN shell
perl -MCPAN -e shell install Catmandu
For more information on module installation, please visit the detailed CPAN module installation guide.