command-definition.grep.xml Maven / Gradle / Ivy
<?xml version="1.0"?> <command-def xmlns="http://www.unix4j.org/command-def" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.unix4j.org/command-def command-def.xsd"> <command name="grep" class="org.unix4j.unix.Grep" package="org.unix4j.unix.grep"/> <name>grep - print lines matching a pattern</name> <synopsis>grep [-ivf] pattern</synopsis> <description ref="grep.html"/> <notes/> <methods> <method args="args" usesStandardInput="true"> Filters the input lines from the standard input or the provided input files and writes the matching lines to the standard output. A line matches if it contains the given {@code "--regexp"} operand value (default operand). Options can be specified by acronym (with a leading dash "-") or by long name (with two leading dashes "--"). Operands other than the default "--regexp" and "--paths" operands have to be prefixed with the operand name. </method> <method args="regexp" usesStandardInput="true"> Filters the input lines from the standard input and writes the matching lines to the standard output. A line matches if it contains the given {@code regexp} using case-sensitive string comparison. </method> <method args="regexp,files" usesStandardInput="false"> Filters the lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given {@code regexp} string using case-sensitive comparison. Line endings are not relevant for the comparison. </method> <method args="pattern" usesStandardInput="true"> Filters the input lines from the standard input and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern} using case-sensitive comparison. Line endings are not relevant for the comparison. </method> <method args="pattern,files" usesStandardInput="false"> Filters the lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern} using case-sensitive comparison. Line endings are not relevant for the comparison. </method> <method args="pattern,paths" usesStandardInput="false"> Filters the lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern} using case-sensitive comparison. Line endings are not relevant for the comparison. </method> <method args="options,regexp" usesStandardInput="true"> Filters the input lines from the standard input and writes the matching lines to the standard output. Every line is matched against the given {@code regexp} string; the exact comparison rules are defined by the specified matching {@code options}. </method> <method args="options,pattern" usesStandardInput="true"> Filters the input lines from the standard input and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern}; the exact comparison rules are defined by the specified matching {@code options}. </method> <method args="options,regexp,files" usesStandardInput="false"> Filters the input lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given {@code regexp} string; the exact comparison rules are defined by the specified matching {@code options}. </method> <method args="options,regexp,paths" usesStandardInput="false"> Filters the input lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given {@code regexp} string; the exact comparison rules are defined by the specified matching {@code options}. </method> <method args="options,pattern,files" usesStandardInput="false" > Filters the input lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern}; the exact comparison rules are defined by the specified matching {@code options}. </method> <method args="options,pattern,paths" usesStandardInput="false"> Filters the input lines from the specified input files and writes the matching lines to the standard output. Every line is matched against the given regular expression {@code pattern}; the exact comparison rules are defined by the specified matching {@code options}. </method> </methods> <options> <option name="ignoreCase" acronym="i"> Match lines ignoring the case when comparing the strings, also known from Unix with its acronym 'i'. </option> <option name="invertMatch" acronym="v"> Invert the match result, that is, a non-matching line is written to the output and a matching line is not. This option is also known from Unix with its acronym 'v'. </option> <option name="fixedStrings" acronym="F"> Use fixed-strings matching instead of regular expressions. This is usually faster than the standard regexp version. (This option is ignored if a {@code pattern} operand is specified instead of the {@code regexp} string). </option> <option name="lineNumber" acronym="n"> Prefix each line of output with the line number within its input file. </option> <option name="count" acronym="c"> Suppress normal output; instead print a count of matching lines for each input file. With the {@code -v}, {@code --invertMatch} option, count non-matching lines. </option> <option name="matchingFiles" acronym="l"> Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. </option> <option name="wholeLine" acronym="x"> Select only those matches that exactly match the whole line excluding the terminating line ending. (This option is ignored if a {@code pattern} operand is specified instead of the {@code regexp} string). </option> </options> <operands default="regexp,paths"> <operand name="regexp" type="String"> Lines will be printed which match the given regular expression. The {@code regexp} string is surrounded with ".*" on both sides unless the {@code --wholeLine} option is specified. If the {@code --fixedStrings} option is used, plain string comparison is used instead of regular expression matching. </operand> <operand name="pattern" type="java.util.regex.Pattern"> Lines will be printed which match the given pattern. </operand> <operand name="paths" type="String..."> Pathnames of the input files to be searched for the pattern; wildcards * and ? are supported; relative paths are resolved on the basis of the current working directory. </operand> <operand name="files" type="java.io.File..."> The input files to be searched for the pattern; relative paths are not resolved (use the string paths argument to enable relative path resolving based on the current working directory). </operand> <operand name="args" type="String..."> String arguments defining the options and operands for the command. Options can be specified by acronym (with a leading dash "-") or by long name (with two leading dashes "--"). Operands other than the default "--pattern" and "--paths" operands have to be prefixed with the operand name (e.g. "--files" for subsequent file operand values). </operand> <operand name="options" type="GrepOptions"> The options defining the types of patterns and command behavior. </operand> </operands> </command-def>