360 Secure SkillHub
360 安全技能中心

Text Search

该 Skill 使用 grep 在指定目录内递归搜索文本模式,返回文件名、行号和匹配行,适合快速定位词语或短语出现的位置。

jinwangmok
jinwangmok
热度 40.14
最近更新 2026-05-11 17:37:41
分类:搜索依赖:代码执行 / 读写文件应用场景:工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add text-search
Metadata
name
text-search
version
1.0.0
description
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.
allowed-tools
Bash(grep:*)
metadata
{"openclaw":{"emoji":"🔍","requires":{"bins":["grep"],"env":[]},"install":[]}}

Text Search

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

Usage

grep -rn <PATTERN> <DIR_PATH>

Arguments:

# Name Description
1 PATTERN Text or pattern to search for
2 DIR_PATH Directory 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)