ROSIE(1)

NAME
rosie - Rosie Pattern Engine (Rosie Pattern Language)

SYNOPSIS
rosie command [ options ] pattern file [...]

DESCRIPTION
rosie searches all given input files for lines that match a pattern. The pattern language is similar to regular expressions, but more powerful. Also, a set of predefined (named) patterns are provided. The pattern library is extensible. rosie patterns are written in Rosie Pattern Language (RPL). A shared library, librosie, provides a programmatic interface to rosie in C, Go, Python, Ruby, Javascript, and other languages that support libffi. rosie can be used for data mining on large data sets, or for the kind of smaller tasks that grep and other regex tools are used for. The output can be plain text, like grep produces, or can be structured JSON, in the form of a parse tree. A number of other output options are available (see below).

Note that, unlike regex tools, the rosie pattern argument can contain RPL definitions, as long as the argument ends with an expression to match. For example 'slw = w{6,6}; (slw)+' both defines the pattern named slw and asks rosie to match input against the expression (slw)+, which matches one or more six letter words.

COMMANDS
The primary commands are match and grep. Help for a command is obtained using the -h option (see below).

grep
    In the style of grep, match the given pattern against lines in the given input files (or the standard input). In this mode, the pattern may match anywhere within a line, and all matches within a line are found. The default output form in this mode is to print the entire line for all lines that match.

help
    Print help text.

info
    Print information about the rosie installation.

list [filter]
    List the available patterns from the library whose name contains the optional filter as a substring.

match
    Match the given pattern against lines in the given input files (or the standard input). Patterns in RPL begin at the start of the input line. See the grep command for behavior that is more like that utility.

repl
    Enter the read-eval-print loop for interactive development and testing of patterns

test
    Execute the pattern tests embedded within the listed rpl files.

trace
    Perform a match, but generate a trace listing of all the steps performed in the matching process. This can be quite a lot of output.

OPTIONS

-f, --file file
    Load a file of rpl code. This option may be repeated.

-h, --help
    Display help for a command. This option must be given after the command name, e.g. rosie match -h.

-o, --output style
    Output match data according to style, which may be color, nocolor, json, line, and possibly other values. Use rosie help to discover what is available in your installation. Note the default output style is color, except for the grep command, which uses line as its default. For compatibility with grep, -o without a style specifier is equivalent to -o nocolor .

--verbose
    When appropriate, output additional information.

--version
    Print the rosie version.

-w, --wholefile
    Match against the whole input file as if it were a single string.

-   Stop reading from the given input files, if any, and start reading from the standard input.

GREP-LIKE OPTIONS

-b, --byte-offset
    Print the byte offset (character position, starting at 1) at the front of each output line.

-c, --count
    Print only the count of the number of lines that matched.

-e pattern
    For compatibility with grep, -e may precede the pattern argument. This option may be repeated, and in that case, they are processed in order. The last use of -e must end with an expression for rosie to match against the input.

-F, --fixed-strings
    Interpret pattern as a set of fixed (literal) strings, instead of an RPL pattern (which reqires double quotes around string literals). -H Print the filename at the front of each output line. When the output style is json, the filename will appear within each json object.

-h, --no-filename
    Do not print the filename at the front of each output line.

-i, --ignore-case
    Use case insensitive matching for the literal strings in a pattern.

-L, --files-without-match
    Print only the names of files that did not contain a match.

-l, --files-with-matches
    Print only the names of files that contained a match.

-n, --line-number
    Print the line number at the front of each output line.

-O  When used with -R, follow symbolic links only if they were listed on the command line. The default is to not follow symbolic links.

-R, -r, --recursive
    Recursively search any subdirectories given.

-S  When used with -R, follow all symbolic links. (The default is to not follow symbolic links.)

ENVIRONMENT

ROSIE_PATH
    A list of directories that rosie will search when looking for a package of patterns to import. The value is a colon-separated string on Unix, and a semi-colon separated string on Windows. Important note: If ROSIE_PATH is not set, rosie imports modules only from its standard library of patterns, which is in the rosie installation diretory, in the subdirectory called rpl. If you set ROSIE_PATH, you must explicitly include the standard library if you want rosie to include the standard library in its search.

ROSIE_COLORS
    A colon-separated list of pattern names with ANSI SGR color/attribute options to use when printing matching text. For example, when "net.any=1;31" is included within ROSIE_COLORS, input text that matches the pattern net.any will be printed in bold (1) red (31) text. ROSIE_COLORS is only consulted when the output style color is selected. ROSIE_COLORS, when set, replaces rosie's default color settings.

FILES

~/.rosierc
    The (optional) personalized file of configuration commands that is processed when rosie starts. In this file, you can... to be determined.

EXAMPLES
To be written

BUGS
rosie does not automatically normalize Unicode input. If a pattern contains composed characters, for example, these will not match their decomposed equivalents in the input (and vice versa).

Bugs and requests for enhancement are listed at

SEE ALSO
librosie(3)

AUTHORS
Jamie A. Jennings

The project contributors are listed in the CONTRIBUTORS file in