MSGGREP(1) User Commands MSGGREP(1)

# [NAME](#NAME)

msggrep - pattern matching on message catalog

# [SYNOPSIS](#SYNOPSIS)

**msggrep** \[*OPTION*] \[*INPUTFILE*]

# [DESCRIPTION](#DESCRIPTION)

Extracts all messages of a translation catalog that match a given pattern or belong to some given source files.

Mandatory arguments to long options are mandatory for short options too.

## [Input file location:](#Input_file_location:)

[INPUTFILE](#INPUTFILE)

input PO file

[**-D**, **--directory**=*DIRECTORY*](#D)

add DIRECTORY to list for input files search

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

## [Output file location:](#Output_file_location:)

[**-o**, **--output-file**=*FILE*](#o)

write output to specified file

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

## [Message selection:](#Message_selection:)

\[-N SOURCEFILE]... \[-M DOMAINNAME]... \[-J MSGCTXT-PATTERN] \[-K MSGID-PATTERN] \[-T MSGSTR-PATTERN] \[-C COMMENT-PATTERN] \[-X EXTRACTED-COMMENT-PATTERN] \[-W WORKFLOW-FLAG] \[-S STICKY-FLAG]

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, or if **-X** is given and the extracted comment matches EXTRACTED-COMMENT-PATTERN, or if **-W** is given and its flags contain WORKFLOW-FLAG, or if **-S** is given and its flags contain STICKY-FLAG.

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 or COMMENT-PATTERN or EXTRACTED-COMMENT-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**, **--location**=*SOURCEFILE*](#N)

select messages extracted from SOURCEFILE

[**-M**, **--domain**=*DOMAINNAME*](#M)

select messages belonging to domain DOMAINNAME

[**-J**, **--msgctxt**](#J)

start of patterns for the msgctxt

[**-K**, **--msgid**](#K)

start of patterns for the msgid

[**-T**, **--msgstr**](#T)

start of patterns for the msgstr

[**-C**, **--comment**](#C)

start of patterns for the translator's comment

[**-X**, **--extracted-comment**](#X)

start of patterns for the extracted comment

[**-E**, **--extended-regexp**](#E)

PATTERN is an extended regular expression

[**-F**, **--fixed-strings**](#F)

PATTERN is a set of newline-separated strings

[**-e**, **--regexp**=*PATTERN*](#e)

use PATTERN as a regular expression

[**-f**, **--file**=*FILE*](#f)

obtain PATTERN from FILE

[**-i**, **--ignore-case**](#i)

ignore case distinctions

[**-W**, **--workflow-flag**=*FLAG*](#W)

select messages with FLAG

[**-S**, **--sticky-flag**=*FLAG*](#S)

select messages with FLAG

[**-v**, **--invert-match**](#v)

output only the messages that do not match any selection criterion

## [Input file syntax:](#Input_file_syntax:)

[**-P**, **--properties-input**](#P)

input file is in Java .properties syntax

[**--stringtable-input**](#stringtable)

input file is in NeXTstep/GNUstep .strings syntax

## [Output details:](#Output_details:)

[**--color**](#color)

use colors and other text attributes always

[**--color**=*WHEN*](#color~2)

use colors and other text attributes if WHEN. WHEN may be 'always', 'never', 'auto', or 'html'.

[**--style**=*STYLEFILE*](#style)

specify CSS style rule file for **--color**

[**--no-escape**](#no)

do not use C escapes in output (default)

[**--escape**](#escape)

use C escapes in output, no extended chars

[**--force-po**](#force)

write PO file even if empty

[**--indent**](#indent)

indented output style

[**--no-location**](#no~2)

suppress '#: filename:line' lines

[**-n**, **--add-location**](#n)

preserve '#: filename:line' lines (default)

[**--strict**](#strict)

strict Uniforum output style

[**-p**, **--properties-output**](#p)

write out a Java .properties file

[**--stringtable-output**](#stringtable~2)

write out a NeXTstep/GNUstep .strings file

[**-w**, **--width**=*NUMBER*](#w)

set output page width

[**--no-wrap**](#no~3)

do not break long message lines, longer than the output page width, into several lines

[**--sort-output**](#sort)

generate sorted output

[**--sort-by-file**](#sort~2)

sort output by file location

## [Informative output:](#Informative_output:)

[**-h**, **--help**](#h)

display this help and exit

[**-V**, **--version**](#V)

output version information and exit

# [AUTHOR](#AUTHOR)

Written by Bruno Haible.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs in the bug tracker at &lt;https://savannah.gnu.org/projects/gettext&gt; or by email to &lt;bug-gettext@gnu.org&gt;.

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2001-2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;https://gnu.org/licenses/gpl.html&gt;  
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

# [SEE ALSO](#SEE_ALSO)

The full documentation for **msggrep** is maintained as a Texinfo manual. If the **info** and **msggrep** programs are properly installed at your site, the command

**info msggrep**

should give you access to the complete manual.

October 2026 GNU gettext-tools 1.0

---

Document: msggrep(1) from gettext 1.0-r8 (Chainguard OS)
Source: https://git.savannah.gnu.org/git/gettext.git
