grep

vb grep [OPTIONS] PATTERN FILENAME ...

Description

Attempt to match the given POSIX extended regular expression PATTERN over all historic versions of FILENAME. The search begins with the most recent version of the file and moves backwards in time. Multiple FILENAMEs can be specified, in which case all named files are searched in reverse chronological order.

For details of the supported regular expression dialect, see https://fossil-scm.org/fossil/doc/trunk/www/grep.md

Options

-c, --count

Suppress normal output; instead print a count of the number of matching files

-i, --ignore-case

Ignore case

-l, --files-with-matches

List only hash for each match

--once

Stop searching after the first match

-s, --no-messages

Suppress error messages about nonexistent or unreadable files

-v, --invert-match

Invert the sense of matching. Show only files that have no matches. Implies -l

--verbose

Show each file as it is analyzed

Examples

  • Init and open a repository

$ vb init grep_repo.vbyte
project-id: d72251262a742ab59a620889d615731b16d9da65
server-id:  7ecd01e21ae988756d0ab48a78e48819aa7bc2cf
admin-user: ubuntu (initial remote-access password is "CrjsabuFi6")
$ vb open -f grep_repo.vbyte
project-name: <unnamed>
repository:   /tmp/sphinx_tests/4e34a252/grep_repo/grep_repo.vbyte
local-root:   /tmp/sphinx_tests/4e34a252/grep_repo/
config-db:    /tmp/sphinx_tests/4e34a252/.visionbyte
project-code: d72251262a742ab59a620889d615731b16d9da65
checkout:     6682aa05ba9dbbf28eb8673560703f58c12245f0 2026-03-31 13:00:20 UTC
tags:         trunk
comment:      initial empty check-in (user: ubuntu)
check-ins:    1
  • Add files with searchable text

$ vb sys echo "TODO: write docs" > docs.txt
$ vb sys echo "fixme: later" > notes.txt
$ vb add .
ADDED  docs.txt
ADDED  notes.txt
$ vb commit -m "docs"
Committed version: 64108a7dd9f2172db775ced5f9848b16e901b4cecb00b8366ea3b2622b2702af
  • Grep for TODO (case-insensitive)

$ vb grep -i "TODO" docs.txt --verbose
Scanning: 2026-03-31 13:00 docs.txt d2d38af971 checkin 64108a7dd9
== 2026-03-31 13:00 docs.txt d2d38af971 checkin 64108a7dd9
1:TODO: write docs
  • Only show count number with matches

$ vb grep -c "TODO" docs.txt
1