msggrep [option] [inputfile]
msggrep program extracts all messages of a translation catalog
that match a given pattern or belong to some given source files.
Input PO file.
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.
Write output to specified file.
The results are written to standard output if no output file is specified or if it is ‘-’.
[-N sourcefile]... [-M domainname]... [-J msgctxt-pattern] [-K msgid-pattern] [-T msgstr-pattern] [-C comment-pattern]
A message is selected if
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.
Select messages extracted from sourcefile. sourcefile can be either a literal file name or a wildcard pattern.
Select messages belonging to domain domainname.
Start of patterns for the msgctxt.
Start of patterns for the msgid.
Start of patterns for the msgstr.
Start of patterns for the translator’s comment.
Start of patterns for the extracted comments.
Specify that pattern is an extended regular expression.
Specify that pattern is a set of newline-separated strings.
Use pattern as a regular expression.
Obtain pattern from file.
Ignore case distinctions.
Output only the messages that do not match any selection criterion, instead of the messages that match a selection criterion.
Assume the input file is a Java ResourceBundle in Java
syntax, not in PO file syntax.
Assume the input file is a NeXTstep/GNUstep localized resource file in
.strings syntax, not in PO file syntax.
Specify whether or when to use colors and other text attributes. See The --color option for details.
Specify the CSS style rule file to use for
See The --style option for details.
Always write an output file even if it contains no message.
Write the .po file using indented style.
Do not write ‘#: filename:line’ lines.
Generate ‘#: filename:line’ lines (default).
The optional type can be either ‘full’, ‘file’, or
‘never’. If it is not given or ‘full’, it generates the
lines with both file name and line number. If it is ‘file’, the
line number part is omitted. If it is ‘never’, it completely
suppresses the lines (same as
Write out a strict Uniforum conforming PO file. Note that this Uniforum format should be avoided because it doesn’t support the GNU extensions.
Write out a Java ResourceBundle in Java
.properties syntax. Note
that this file format doesn’t support plural forms and silently drops
Write out a NeXTstep/GNUstep localized resource file in
Note that this file format doesn’t support plural forms.
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.
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.
Generate sorted output. Note that using this option makes it much harder for the translator to understand each message’s context.
Sort output by file location.
Display this help and exit.
Output version information and exit.
To extract the messages that come from the source files
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
msggrep --msgstr -F -f wordlist.txt input.po