grep — Pattern Search

Search files for regex patterns with context lines, byte offsets, and language metadata.

Usage

aict grep [flags] <pattern> [path...]

Flags

FlagDescription
-rRecursive directory search
-nShow line numbers
-lList matching files only
-iCase-insensitive search
-wMatch whole words only
-A NShow N lines after match
-B NShow N lines before match
-C NShow N lines of context
-cCount matches per file
-vInvert match
-EExtended regex
-FFixed string (literal)
--includeInclude files matching glob
--exclude-dirExclude directories matching glob

XML Output

<grep timestamp="1234567890" pattern="func" recursive="true"
      case_sensitive="true" match_type="regex"
      searched_files="100" matched_files="3" total_matches="12"
      search_root="/project">
  <file path="main.go" absolute="/project/main.go" matches="5" language="go">
    <match line="10" col="1" offset_bytes="200">
      <before>package main</before>
      <text>func main() {</text>
      <after>    fmt.Println("hello")</after>
    </match>
  </file>
</grep>

Empty Results

<grep timestamp="1234567890" pattern="neverexists" recursive="false"
      case_sensitive="true" match_type="regex"
      searched_files="0" matched_files="0" total_matches="0"
      search_root=".">
</grep>