VGREP(1)
π VGREP β bestie edition π
okay so this is vgrep (and its two little siblings vegrep and vfgrep), from the General Commands Manual section 1. grab a snack, we're doing regexes π
β¨ NAME β¨
vgrep, vegrep, vfgrep β print lines matching a pattern π¦
β¨ SYNOPOSIS β¨
(no that's not a typo i made, that's genuinely what the page says, iconic honestly)
vgrep [ vbind-options ] [ -[[AB] ]num ] [ -[CEFGVBchilnsvwx] ] [ -e ]
pattern | -ffile ] [ names... ]
β¨ DESCRIPTION β¨
so Vgrep is literally GNU grep but with a patch so it can reach into AtFS version objects π. It searches the files and the AtFS version objects you list in the arguments β or standard input if you give it no names at all, or if you hand it the name - β looking for lines that contain a match to your pattern. By default, vgrep prints the matching lines. simple. slay.
There are three major variants of vgrep, and they're controlled by these options right here:
-Gβ treat pattern as a basic regular expression (details below). this is the default, the og, the main character π-Eβ treat pattern as an extended regular expression (details below too)-Fβ treat pattern as a list of fixed strings, separated by newlines, and it matches if any of them match
and wait, there's more π β two extra variant programs exist: vegrep and vfgrep. Vegrep is similar to vgrep -E but not identical, and it's compatible with the historical Unix egrep. Vfgrep is exactly the same as vgrep -F. periodt.
Vgrep also understands the standard version binding options of the Shape toolkit. the names you put on the command line get replaced by the appropriate version IDs of the selected version object. β¨
The vbind-options are shapeTools' standard options for version binding. you can find a whole description of those options in the manual page of vbind(1). iykyk.
All variants of vgrep understand the following options:
-numβ matches get printed with num lines of leading and trailing context. but heads up bestie:vgrepwill never print any given line more than once π-A numβ print num lines of trailing context after matching lines-B numβ print num lines of leading context before matching lines-Cβ equivalent to-2-Vβ print the version number ofvgrepto standard error. and fr fr, this version number should be included in all bug reports (see below) π-bβ print the byte offset within the input file before each line of output-cβ suppress normal output; instead print a count of matching lines for each input file. and with the-voption (see below), it counts the non-matching lines instead-epattern β use pattern as the pattern. super useful for protecting patterns that start with-π«Ά-ffile β obtain the pattern from file-hβ suppress the prefixing of filenames on output when multiple files are being searched-iβ ignore case distinctions in both the pattern and the input files-Lβ suppress normal output; instead print the name of each input file from which no output would normally have been printed-lβ suppress normal output; instead print the name of each input file from which output would normally have been printed-nβ prefix each line of output with the line number within its input file-qβ quiet; suppress normal output π€«-sβ suppress error messages about nonexistent or unreadable files-vβ invert the sense of matching, so it selects the non-matching lines π₯-wβ select only those lines containing matches that form whole words. the test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. similarly, it must be either at the end of the line or followed by a non-word constituent character. word-constituent characters are letters, digits, and the underscore-xβ select only those matches that exactly match the whole line
β¨ REGULAR EXPRESSIONS β¨
A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions β you use various operators to combine smaller expressions. cute, right? πΈ
Vgrep understands two different versions of regular expression syntax: basic''</purple> and <purple>extended.'' In GNU grep, there's no difference in available functionality between the two syntaxes. In other implementations though, basic regular expressions are less powerful. the following description applies to extended regular expressions; the differences for basic regular expressions are summarized afterwards. π
The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular expressions that match themselves. Any metacharacter with special meaning may be quoted by preceding it with a backslash. β¨
A list of characters enclosed by [ and ] matches any single character in that list; if the first character of the list is the caret ^ then it matches any character not in the list. For example, the regular expression [0123456789] matches any single digit. A range of ASCII characters may be specified by giving the first and last characters, separated by a hyphen. Finally, certain named classes of characters are predefined. Their names are self explanatory, and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:]. For example, [[:alnum:]] means [0-9A-Za-z] β except the latter form is dependent upon the ASCII character encoding, whereas the former is portable. (Note that the brackets in these class names are part of the symbolic names, and must be included in addition to the brackets delimiting the bracket list.) Most metacharacters lose their special meaning inside lists. To include a literal ] place it first in the list. Similarly, to include a literal ^ place it anywhere but first. Finally, to include a literal - place it last. π
The period . matches any single character. The symbol \w is a synonym for [[:alnum:]] and \W is a synonym for [^[:alnum]]. β
The caret ^ and the dollar sign $ are metacharacters that respectively match the empty string at the beginning and end of a line. The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word, and \B matches the empty string provided it's not at the edge of a word. π
A regular expression matching a single character may be followed by one of several repetition operators:
?β the preceding item is optional and matched at most once*β the preceding item will be matched zero or more times+β the preceding item will be matched one or more times{n}β the preceding item is matched exactly n times{n,}β the preceding item is matched n or more times{,m}β the preceding item is optional and is matched at most m times{n,m}β the preceding item is matched at least n times, but not more than m times
Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated subexpressions. π«
Two regular expressions may be joined by the infix operator |; the resulting regular expression matches any string matching either subexpression. π¦
Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole subexpression may be enclosed in parentheses to override these precedence rules. π
The backreference \n, where n is a single digit, matches the substring previously matched by the *n*th parenthesized subexpression of the regular expression. π
In basic regular expressions the metacharacters ?, +, {, |, (, and ) lose their special meaning; instead use the backslashed versions \?, \+, \{, \|, \(, and \). π
In vegrep the metacharacter { loses its special meaning; instead use \{. π
β¨ DIAGNOSTICS β¨
Normally, exit status is 0 if matches were found, and 1 if no matches were found. (The -v option inverts the sense of the exit status.) Exit status is 2 if there were syntax errors in the pattern, inaccessible input files, or other system errors. π
β¨ EXAMPLES β¨
Grep for ``foo'' in version 1.43 of smile.c:
vgrep foo smile.c[1.43]
Grep for ``foo'' in the last version of smile.c (last saved version or busy file, if available):
vgrep -last foo smile.c
Grep for ``foo'' in all versions of C files that have been created since February 14 1993:
vgrep -since 14.2.93 foo \β.c
Grep for foo'' in all versions carrying the symbolic name Release-2.3'':
vgrep foo \β[Release-2.3]
β¨ SEE ALSO β¨
emacs(1), ed(1), sh(1), vbind(1), atread(3), GNU Emacs Manual πΈ
β¨ BUGS β¨
Email bug reports to bug-gnu-utils@prep.ai.mit.edu. and please bestie, be sure to include the word grep'' somewhere in the Subject:'' field π
Large repetition counts in the{m,n}construct may causevgrepto use lots of memory. In addition, certain other obscure regular expressions require exponential time and space, and may causevgrepto run out of memory. not the vibe. π
Backreferences are very slow, and may require exponential time. π
and that's the whole page, bestie! this one came from the GNU Project, dated 1992 September 10 β genuinely vintage, genuinely iconic ππ take care of your memory, hydrate, and always quote your metacharacters. mwah π β¨
π¦ where this page comes from
- debian bookworm: atfs 1.4pl6-15+b1
- ubuntu jammy: atfs 1.4pl6-15
- ubuntu noble: atfs 1.4pl6-16.1build1
- ubuntu resolute: atfs 1.4pl6-17
- ubuntu stonking: atfs 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms