     msggrep [OPTION] [INPUTFILE]

The msggrep program extracts all messages of a translation catalog that match a given pattern or belong to some given source files.

Input file location
-------------------

INPUTFILE
     Input PO file.

-D DIRECTORY
--directory=DIRECTORY
     Add DIRECTORY to the list of directories.  Source files are searched relative to this list of directories.  The resulting .po file will be written relative to the current directory, though.

If no INPUTFILE is given or if it is -, standard input is read.

Output file location
--------------------

-o FILE
--output-file=FILE
     Write output to specified file.

The results are written to standard output if no output file is specified or if it is -.

Message selection
-----------------

       [-N SOURCEFILE]... [-M DOMAINNAME]...
       [-J MSGCTXT-PATTERN] [-K MSGID-PATTERN] [-T MSGSTR-PATTERN]
       [-C COMMENT-PATTERN]

A message is selected if

  * it comes from one of the specified source files,

  * or if it comes from one of the specified domains,

  * or if -J is given and its context (msgctxt) matches MSGCTXT-PATTERN,

  * or if -K is given and its key (msgid or msgid_plural) matches MSGID-PATTERN,

  * or if -T is given and its translation (msgstr) matches MSGSTR-PATTERN,

  * or if -C is given and the translator's comment matches COMMENT-PATTERN.

When more than one selection criterion is specified, the set of selected messages is the union of the selected messages of each criterion.

MSGCTXT-PATTERN or MSGID-PATTERN or MSGSTR-PATTERN syntax:

       [-E | -F] [-e PATTERN | -f FILE]...

PATTERNs are basic regular expressions by default, or extended regular expressions if -E is given, or fixed strings if -F is given.

-N SOURCEFILE
--location=SOURCEFILE
     Select messages extracted from SOURCEFILE.  SOURCEFILE can be either a literal file name or a wildcard pattern.

-M DOMAINNAME
--domain=DOMAINNAME
     Select messages belonging to domain DOMAINNAME.

-J
--msgctxt
     Start of patterns for the msgctxt.

-K
--msgid
     Start of patterns for the msgid.

-T
--msgstr
     Start of patterns for the msgstr.

-C
--comment
     Start of patterns for the translator's comment.

-X
--extracted-comment
     Start of patterns for the extracted comments.

-E
--extended-regexp
     Specify that PATTERN is an extended regular expression.

-F
--fixed-strings
     Specify that PATTERN is a set of newline-separated strings.

-e PATTERN
--regexp=PATTERN
     Use PATTERN as a regular expression.

-f FILE
--file=FILE
     Obtain PATTERN from FILE.

-i
--ignore-case
     Ignore case distinctions.

-v
--invert-match
     Output only the messages that do not match any selection criterion, instead of the messages that match a selection criterion.

Input file syntax
-----------------

-P
--properties-input
     Assume the input file is a Java ResourceBundle in Java .properties syntax, not in PO file syntax.

--stringtable-input
     Assume the input file is a NeXTstep/GNUstep localized resource file in .strings syntax, not in PO file syntax.

Output details
--------------

--color
--color=WHEN
     Specify whether or when to use colors and other text attributes. See The --color option for details.

--style=STYLE_FILE
     Specify the CSS style rule file to use for --color. See The --style option for details.

--force-po
     Always write an output file even if it contains no message.

--indent
     Write the .po file using indented style.

--no-location
     Do not write #: FILENAME:LINE lines.

--add-location
     Generate #: FILENAME:LINE lines (default).

--strict
     Write out a strict Uniforum conforming PO file.  Note that this Uniforum format should be avoided because it doesn't support the GNU extensions.

-p
--properties-output
     Write out a Java ResourceBundle in Java .properties syntax.  Note that this file format doesn't support plural forms and silently drops obsolete messages.

--stringtable-output
     Write out a NeXTstep/GNUstep localized resource file in .strings syntax. Note that this file format doesn't support plural forms.

-w NUMBER
--width=NUMBER
     Set the output page width.  Long strings in the output files will be split across multiple lines in order to ensure that each line's width (= number of screen columns) is less or equal to the given NUMBER.

--no-wrap
     Do not break long message lines.  Message lines whose width exceeds the output page width will not be split into several lines.  Only file reference lines which are wider than the output page width will be split.

--sort-output
     Generate sorted output.  Note that using this option makes it much harder for the translator to understand each message's context.

--sort-by-file
     Sort output by file location.

Informative output
------------------

-h
--help
     Display this help and exit.

-V
--version
     Output version information and exit.

Examples
--------

To extract the messages that come from the source files gnulib-lib/error.c and gnulib-lib/getopt.c:

     msggrep -N gnulib-lib/error.c -N gnulib-lib/getopt.c input.po

To extract the messages that contain the string ``Please specify'' in the original string:

     msggrep --msgid -F -e 'Please specify' input.po

To extract the messages that have a context specifier of either ``Menu>File'' or ``Menu>Edit'' or a submenu of them:

     msggrep --msgctxt -E -e '^Menu>(File|Edit)' input.po

To extract the messages whose translation contains one of the strings in the file wordlist.txt:

     msggrep --msgstr -F -f wordlist.txt input.po