|
|
GLARK(1) glark 1.8.0 GLARK(1) NAME
glark - Search text files for complex regular expressions SYNOPSIS
glark [options] expression file ... DESCRIPTION
Similar to "grep", "glark" offers: Perl-compatible regular expressions, color highlighting of matches, context around matches, complex expressions ("and" and "or"), grep output emulation, and automatic exclusion of non-text files. Its regular expressions should be familiar to persons experienced in Perl, Python, or Ruby. File may also be a list of files in the form of a path. OPTIONS
Input -0[nnn] Use nn (octal) as the input record separator. If nnn is omitted, use ' ' as the record separator, which treats paragraphs as lines. -d ACTION, --directories=ACTION Directories are processed according to the given ACTION, which by default is "read". If ACTION is "recurse", each file in the directory is read and each subdirectory is recursed into (equivalent to the "-r" option). If ACTION is "skip", directories are not read, and no message is produced. --binary-files=TYPE Specify how to handle binary files, thus overriding the default behavior, which is to denote the binary files that match the expression, without displaying the match. TYPE may be one of: "binary", the default; "without-match", which results in binary files being skipped; and "text", which results in the binary file being treated as text, the display of which may have bad side effects with the terminal. Note that the default behavior has changed; this previously was to skip binary files. The same effect may be achieved by setting binary-files to "without-match" in the ~/.glarkrc file. --[with-]basename EXPR, --[with-]name EXPR Search only files whose names match the given regular expression. As in find(1), this works on the basename of the file. This expression can be negated and modified with "!" and "i", such as '!/io.[hc]$/i'. --[with-]fullname EXPR, --[with-]path EXPR Search only files whose names, including path, match the given regular expression. As in find(1), this works on the path of the file. This expression can be negated and modified with "!" and "i", such as '!/Dialog.*.java$/i'. --without-basename EXPR, --without-name EXPR Do not search files with base names matching the given regular expression. --without-fullname EXPR, --without-path EXPR Do not search files with full names matching the given regular expression. -M, --exclude-matching Do not search files whose names match the given expression. This can be useful for finding external references to a file, or to a class (assuming that class names match file names). -r, --recurse Recurse through directories. Equivalent to --directories=read. --split-as-path(=VALUE), --no-split-as-path Sets whether, if a command line argument includes the path separator (such as ":"), the argument should be split by the path sepa- rator. This functionality is useful for using environment variables as input, such as $PATH and $CLASSPATH, which are automatically split and processed as a list of files and directories. The default value of this option is "true". "--no-split-as-path" is equiv- alent to "--split-as-path=false". --size-limit=SIZE If provided, files no larger than SIZE bytes will be searched. This is useful when running the "--recurse" option on directories that may contain large files. Matching -a NUM expr1 expr2 --and NUM expr1 expr2 --and=NUM expr1 expr2 ( expr1 --and=NUM expr2 ) Match both of the two expressions, within NUM lines of each other. See the EXPRESSIONS section for more information. -b NUM[%], --before NUM[%] Restrict the search to before the given location, which represents either the number of the last line within the valid range, or the percentage of lines to be searched. --after NUM[%] Restrict the search to after the given section, which represents either the number of the first line within the valid range, or the percentage of lines to be skipped. -f FILE, --file=FILE Use the lines in the given file as expressions. Each line consists of a regular expression. -i, --ignore-case Match regular expressions without regard to case. The default is case sensitive. -m NUM, --match-limit NUM Find only the first NUM matches in each file. -o expr1 expr2 --or expr1 expr2 ( expr1 --or expr2 ) Match either of the two expressions. See the EXPRESSIONS section for more information. -R, --range NUM[%],NUM[%] Restrict the search to the given range of lines, as either line numbers or a percentage of the length of the file. -v, --invert-match Show lines that do not match the expression. -w, --word, --word-regexp Put word boundaries around each pattern, thus matching only where the full word(s) occur in the text. Thus, "glark -w Foo" is the same as "glark '/Foo/'". -x, --line-regexp Select only where the entire line matches the pattern(s). --xor expr1 expr2 ( expr1 --xor expr2 ) Match either of the two expressions, but not both. See the EXPRESSIONS section for more information. Output -A NUM, --after-context=NUM Print NUM lines after a matched expression. -B NUM, --before-context=NUM Print NUM lines before a matched expression. -C [NUM], -NUM, --context[=NUM] Output NUM lines of context around a matched expression. The default is no context. If no NUM is given for this option, the number of lines of context is 2. -c, --count Instead of normal output, display only the number of matches in each file. -F, --file-color COLOR Specify the highlight color for file names. See the HIGHLIGHTING section for the values that can be used. --no-filter Display the entire file(s), presumably with matches highlighted. -g, --grep Produce output like the grep default: file names, no line numbers, and a single line of the match, which will be the first line for matches that span multiple lines. If the EMACS environment variable is set, this value is set to true. Thus, running glark under Emacs results in the output format expected by Emacs. -h, --no-filename Do not display the names of the files that matched. -H, --with-filename Display the names of the files that matched. This is the default behavior. -l, --files-with-matches Print only the names of the file that matched the expression. -L, --files-without-match Print only the names of the file that did not match the expression. --label=NAME Use NAME as output file name. This is useful when reading from standard input. -n, --line-number Display the line numbers. This is the default behavior. -N, --no-line-number Do not display the line numbers. --line-number-color Specify the highlight color for line numbers. This defaults to none (no highlighting). See the HIGHLIGHTING section for more infor- mation. -T, --text-color COLOR Specify the highlight color for text. See the HIGHLIGHTING section for more information. --text-color-NUM COLOR Specify the highlight color for the regular expression capture NUM. Colors are used by regular expressions in the order they are created (that is, with the "--and" and "--or" option), or with captures within a regular expression (such as '/(this)|(that)/'). is See the HIGHLIGHTING section for more information. -u, --highlight=[FORMAT] Enable highlighting. This is the default behavior. Format is "single" (one color) or "multi" (different color per regular expres- sion). See the HIGHLIGHTING section for more information. -U, --no-highlight Disable highlighting. -y, --extract-matches Display only the region that matched, not the entire line. If the expression contains "backreferences" (i.e., expressions bounded by "( ... )"), then only the portion captured will be displayed, not the entire line. This option is useful with "-g", which elimi- nates the default highlighting and display of file names. -Z, --null When in -l mode, write file names followed by the ASCII NUL character ('