Text Search

Other

Search for a text pattern in files within a directory. Shows matching lines with filenames and line numbers. Use when the user wants to find where a word or phrase appears in their files.

Install

openclaw skills install text-search

Text Search

Find a word or phrase in files within a directory with a single command.

Usage

grep -rn <PATTERN> <DIR_PATH>

Arguments:

#NameDescription
1PATTERNText or pattern to search for
2DIR_PATHDirectory to search in

Example

grep -rn "TODO" /home/user/project

Output:

/home/user/project/main.py:12:# TODO: fix this
/home/user/project/utils.py:5:# TODO: add tests

Format: FILENAME:LINE_NUMBER:MATCHING_LINE

Success / Failure

  • Success: Matching lines printed (exit code 0)
  • No matches: No output (exit code 1 — this is normal, not an error)
  • Failure: Error message (exit code 2, e.g. directory not found)