marc21-grep(1)
NAME
marc21-grep — Search for records whose values match a pattern
SYNOPSIS
marc21 grep [OPTIONS] <PATTERN> [INPUT]…
DESCRIPTION
The grep command searches for records whose values match one or
multiple patterns (regular expressions). Only values from control and
data fields are searched.
ARGUMENTS
<PATTERN>- A regular expression used for searching.
OPTIONS
--or <pattern>- Search for multiple, possibly overlapping, regexes in a single search. The regular expression consists of the main pattern and all other pattern passed by this option. The regex matches if a subfield is found that matches against at least one pattern.
-i,--ignore-case- If this flag is set, matching will be performed case insensitive.
This setting applies to all specified patterns. If you want to match
only a single pattern in a case-insensitive mode, you can do so
using the inline flag
i. For example,(?i:foo)matchesfoocase insensitively while(?-i:foo)matchesfoocase sensitively. -v,--invert-match- Inverts the specified regular expression, which means that only records that do not match the criterion are returned.
-o <filename>,--output <filename>- Write output to
<filename>instead ofstdout.
FILTER OPTIONS
-l,--limit <n>- Limit the result to first
<n>records (a limit value0means no limit) -s,--skip-invalid- Skip invalid records that can’t be decoded
--strsim-threshold <value>- The minimum score for string similarity comparisons. The value must be between 0 and 100.
--where- An filter expression for filtering records
--filter-normalization <form>- Transliterate the given filter or query expression into the
specified Unicode normal form. Possible values:
nfd,nfkd,nfc,nfkc. This option can also be specified by setting the environment variableMARC21_FILTER_NORMALIZATION.
COMMON OPTIONS
-p,--progress- If set, show a progress bar
--compression- Specify compression level (0..=9)
EXIT STATUS
0— Command succeeded.1— Command failed.
EXAMPLES
In the following example, all records that have a field with a value
that matches the regular expression ^MARC[-\s]21$ are returned:
$ marc21 grep '^MARC[-\s]21$' GND.mrc.gz -o out.mrc