#!/usr/bin/env perl

use strict;
use warnings;

use App::MARC::Filter;

our $VERSION = 0.11;

# Run.
exit App::MARC::Filter->new->run;

# Print version.
sub VERSION_MESSAGE {
	print $VERSION."\n";
	exit 0;
}

__END__

=pod

=encoding utf8

=head1 NAME

marc-filter - Tool to filter records in MARC dataset.

=head1 SYNOPSIS

 marc-filter [-e] [-h] [-i] [-n num] [-o format] [-r] [--version] marc_file search_item [sub_search_item] [value]

=head1 DESCRIPTION

Tool to filter MARC records in big datasets. Could filter by control field or field/subfield or
leader or material type. Tool could filter by number of output records.

It supports MARC XML and USMARC files now.

=head1 ARGUMENTS

=over 8

=item * C<-e>

Match field/subfield existence.

=item * C<-h>

Print help.

=item * C<-i>

Invert searching.

=item * C<-n num>

Number of records to output,

Default value is all records to output.

=item * C<-o format>

Output MARC format.

Possible formats are ascii, xml.

=item * C<-r>

Use value as Perl regexp.

=item * C<--version>

Print version of script.

=item * C<marc_file>

MARC XML or USMARC file name.

Input file could be compressed by L<IO::Uncompress::AnyUncompress> module.
Possibility is to uncompress gzip, zip, bzip2, zstd, xz, lzma, lzip, lzf or
lzop.

=item * C<search_item>

Search item could be MARC control field or MARC field or 'leader' string or
material type string.

Possible material type strings are:

=over

=item * book

=item * computer_file

=item * continuing_resource

=item * map

=item * mixed_material

=item * music

=item * visual_material

=back

=item * C<sub_search_item>

In the case of MARC field this could be a subfield.
It's optional with C<-e>.

=item * C<value>

Value to filter.
It's required without C<-e>.

=back

=head1 REPOSITORY

L<https://github.com/michal-josef-spacek/App-MARC-Filter>

=head1 AUTHOR

Michal Josef Špaček L<mailto:skim@cpan.org>

L<http://skim.cz>

=head1 LICENSE AND COPYRIGHT

© 2022-2026 Michal Josef Špaček

BSD 2-Clause License

=head1 ACKNOWLEDGEMENTS

Development of this software has been made possible by institutional support
for the long-term strategic development of the National Library of the Czech
Republic as a research organization provided by the Ministry of Culture of
the Czech Republic (DKRVO 2024–2028), Area 11: Linked Open Data.

=head1 VERSION

0.11

=cut
