2 @cindex @code{msggrep} program, usage
4 msggrep [@var{option}] [@var{inputfile}]
7 @cindex search messages in a catalog
8 The @code{msggrep} program extracts all messages of a translation catalog
9 that match a given pattern or belong to some given source files.
11 @subsection Input file location
17 @item -D @var{directory}
18 @itemx --directory=@var{directory}
19 @opindex -D@r{, @code{msggrep} option}
20 @opindex --directory@r{, @code{msggrep} option}
21 Add @var{directory} to the list of directories. Source files are
22 searched relative to this list of directories. The resulting @file{.po}
23 file will be written relative to the current directory, though.
27 If no @var{inputfile} is given or if it is @samp{-}, standard input is read.
29 @subsection Output file location
33 @itemx --output-file=@var{file}
34 @opindex -o@r{, @code{msggrep} option}
35 @opindex --output-file@r{, @code{msggrep} option}
36 Write output to specified file.
40 The results are written to standard output if no output file is specified
43 @subsection Message selection
46 [-N @var{sourcefile}]... [-M @var{domainname}]...
47 [-J @var{msgctxt-pattern}] [-K @var{msgid-pattern}] [-T @var{msgstr-pattern}]
48 [-C @var{comment-pattern}]
51 A message is selected if
53 @item it comes from one of the specified source files,
54 @item or if it comes from one of the specified domains,
55 @item or if @samp{-J} is given and its context (msgctxt) matches
56 @var{msgctxt-pattern},
57 @item or if @samp{-K} is given and its key (msgid or msgid_plural) matches
59 @item or if @samp{-T} is given and its translation (msgstr) matches
61 @item or if @samp{-C} is given and the translator's comment matches
62 @var{comment-pattern}.
65 When more than one selection criterion is specified, the set of selected
66 messages is the union of the selected messages of each criterion.
68 @var{msgctxt-pattern} or @var{msgid-pattern} or @var{msgstr-pattern} syntax:
70 [-E | -F] [-e @var{pattern} | -f @var{file}]...
72 @var{pattern}s are basic regular expressions by default, or extended regular
73 expressions if -E is given, or fixed strings if -F is given.
76 @item -N @var{sourcefile}
77 @itemx --location=@var{sourcefile}
78 @opindex -N@r{, @code{msggrep} option}
79 @opindex --location@r{, @code{msggrep} option}
80 Select messages extracted from @var{sourcefile}. @var{sourcefile} can be
81 either a literal file name or a wildcard pattern.
83 @item -M @var{domainname}
84 @itemx --domain=@var{domainname}
85 @opindex -M@r{, @code{msggrep} option}
86 @opindex --domain@r{, @code{msggrep} option}
87 Select messages belonging to domain @var{domainname}.
91 @opindex -J@r{, @code{msggrep} option}
92 @opindex --msgctxt@r{, @code{msggrep} option}
93 Start of patterns for the msgctxt.
97 @opindex -K@r{, @code{msggrep} option}
98 @opindex --msgid@r{, @code{msggrep} option}
99 Start of patterns for the msgid.
103 @opindex -T@r{, @code{msggrep} option}
104 @opindex --msgstr@r{, @code{msggrep} option}
105 Start of patterns for the msgstr.
109 @opindex -C@r{, @code{msggrep} option}
110 @opindex --comment@r{, @code{msggrep} option}
111 Start of patterns for the translator's comment.
114 @itemx --extracted-comment
115 @opindex -X@r{, @code{msggrep} option}
116 @opindex --extracted-comment@r{, @code{msggrep} option}
117 Start of patterns for the extracted comments.
120 @itemx --extended-regexp
121 @opindex -E@r{, @code{msggrep} option}
122 @opindex --extended-regexp@r{, @code{msggrep} option}
123 Specify that @var{pattern} is an extended regular expression.
126 @itemx --fixed-strings
127 @opindex -F@r{, @code{msggrep} option}
128 @opindex --fixed-strings@r{, @code{msggrep} option}
129 Specify that @var{pattern} is a set of newline-separated strings.
131 @item -e @var{pattern}
132 @itemx --regexp=@var{pattern}
133 @opindex -e@r{, @code{msggrep} option}
134 @opindex --regexp=@r{, @code{msggrep} option}
135 Use @var{pattern} as a regular expression.
138 @itemx --file=@var{file}
139 @opindex -f@r{, @code{msggrep} option}
140 @opindex --file@r{, @code{msggrep} option}
141 Obtain @var{pattern} from @var{file}.
145 @opindex -i@r{, @code{msggrep} option}
146 @opindex --ignore-case@r{, @code{msggrep} option}
147 Ignore case distinctions.
150 @itemx --invert-match
151 @opindex -v@r{, @code{msggrep} option}
152 @opindex --invert-match@r{, @code{msggrep} option}
153 Output only the messages that do not match any selection criterion, instead
154 of the messages that match a selection criterion.
158 @subsection Input file syntax
162 @itemx --properties-input
163 @opindex -P@r{, @code{msggrep} option}
164 @opindex --properties-input@r{, @code{msggrep} option}
165 Assume the input file is a Java ResourceBundle in Java @code{.properties}
166 syntax, not in PO file syntax.
168 @item --stringtable-input
169 @opindex --stringtable-input@r{, @code{msggrep} option}
170 Assume the input file is a NeXTstep/GNUstep localized resource file in
171 @code{.strings} syntax, not in PO file syntax.
175 @subsection Output details
177 @c --no-escape and --escape omitted on purpose. They are not useful.
181 @itemx --color=@var{when}
182 @opindex --color@r{, @code{msggrep} option}
183 Specify whether or when to use colors and other text attributes.
184 See @ref{The --color option} for details.
186 @item --style=@var{style_file}
187 @opindex --style@r{, @code{msggrep} option}
188 Specify the CSS style rule file to use for @code{--color}.
189 See @ref{The --style option} for details.
192 @opindex --force-po@r{, @code{msggrep} option}
193 Always write an output file even if it contains no message.
196 @opindex --indent@r{, @code{msggrep} option}
197 Write the .po file using indented style.
200 @opindex --no-location@r{, @code{msggrep} option}
201 Do not write @samp{#: @var{filename}:@var{line}} lines.
204 @itemx --add-location=@var{type}
205 @opindex --add-location@r{, @code{msggrep} option}
206 Generate @samp{#: @var{filename}:@var{line}} lines (default).
208 The optional @var{type} can be either @samp{full}, @samp{file}, or
209 @samp{never}. If it is not given or @samp{full}, it generates the
210 lines with both file name and line number. If it is @samp{file}, the
211 line number part is omitted. If it is @samp{never}, it completely
212 suppresses the lines (same as @code{--no-location}).
215 @opindex --strict@r{, @code{msggrep} option}
216 Write out a strict Uniforum conforming PO file. Note that this
217 Uniforum format should be avoided because it doesn't support the
221 @itemx --properties-output
222 @opindex -p@r{, @code{msggrep} option}
223 @opindex --properties-output@r{, @code{msggrep} option}
224 Write out a Java ResourceBundle in Java @code{.properties} syntax. Note
225 that this file format doesn't support plural forms and silently drops
228 @item --stringtable-output
229 @opindex --stringtable-output@r{, @code{msggrep} option}
230 Write out a NeXTstep/GNUstep localized resource file in @code{.strings} syntax.
231 Note that this file format doesn't support plural forms.
233 @item -w @var{number}
234 @itemx --width=@var{number}
235 @opindex -w@r{, @code{msggrep} option}
236 @opindex --width@r{, @code{msggrep} option}
237 Set the output page width. Long strings in the output files will be
238 split across multiple lines in order to ensure that each line's width
239 (= number of screen columns) is less or equal to the given @var{number}.
242 @opindex --no-wrap@r{, @code{msggrep} option}
243 Do not break long message lines. Message lines whose width exceeds the
244 output page width will not be split into several lines. Only file reference
245 lines which are wider than the output page width will be split.
248 @opindex --sort-output@r{, @code{msggrep} option}
249 Generate sorted output. Note that using this option makes it much harder
250 for the translator to understand each message's context.
253 @opindex --sort-by-file@r{, @code{msggrep} option}
254 Sort output by file location.
258 @subsection Informative output
263 @opindex -h@r{, @code{msggrep} option}
264 @opindex --help@r{, @code{msggrep} option}
265 Display this help and exit.
269 @opindex -V@r{, @code{msggrep} option}
270 @opindex --version@r{, @code{msggrep} option}
271 Output version information and exit.
277 To extract the messages that come from the source files
278 @code{gnulib-lib/error.c} and @code{gnulib-lib/getopt.c}:
281 msggrep -N gnulib-lib/error.c -N gnulib-lib/getopt.c input.po
284 To extract the messages that contain the string ``Please specify'' in the
288 msggrep --msgid -F -e 'Please specify' input.po
291 To extract the messages that have a context specifier of either ``Menu>File''
292 or ``Menu>Edit'' or a submenu of them:
295 msggrep --msgctxt -E -e '^Menu>(File|Edit)' input.po
298 To extract the messages whose translation contains one of the strings in the
299 file @code{wordlist.txt}:
302 msggrep --msgstr -F -f wordlist.txt input.po