LinuxCommandLibrary

grn

Search groonga datasets

SYNOPSIS

grn [options] pattern [file...]

PARAMETERS

pattern
    The regular expression to search for.

[file...]
    One or more input files to search. If no files are specified, `grn` reads from standard input.

DESCRIPTION

The `grn` command is a tool for searching text files for lines that match a regular expression, similar to `grep`. However, `grn` uniquely prefixes each matching line with its line number within the file. This can be very useful when you need to locate the exact position of a match within a large file for debugging, analysis, or editing purposes. The line numbers provided by `grn` are sequential within each input file. `grn` reads one or more input files, or standard input if no files are specified. It prints lines matching the pattern, prefixed by their line number and a colon.

USAGE EXAMPLE

To search for the word "error" in the file `logfile.txt` and print the matching lines with their line numbers:
grn error logfile.txt

Copied to clipboard