grep_count
Count occurrences of a specific pattern in files or directories using regex or plain text. Specify case sensitivity, whole-word matches, and file extensions. Display totals or counts per file.
Instructions
Count the number of matches for a pattern
Input Schema
Name | Required | Description | Default |
---|---|---|---|
by_file | No | Show count per file when searching directories | |
case_sensitive | No | Whether the search should be case sensitive | |
file_extensions | No | Only search files with these extensions | |
pattern | Yes | Regular expression pattern or plain text to count | |
target | Yes | File or directory path to search in | |
whole_words | No | Match whole words only |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"by_file": {
"default": false,
"description": "Show count per file when searching directories",
"type": "boolean"
},
"case_sensitive": {
"default": false,
"description": "Whether the search should be case sensitive",
"type": "boolean"
},
"file_extensions": {
"description": "Only search files with these extensions",
"items": {
"type": "string"
},
"type": "array"
},
"pattern": {
"description": "Regular expression pattern or plain text to count",
"type": "string"
},
"target": {
"description": "File or directory path to search in",
"type": "string"
},
"whole_words": {
"default": false,
"description": "Match whole words only",
"type": "boolean"
}
},
"required": [
"pattern",
"target"
],
"type": "object"
}