text-tools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseText Tools Skill
文本处理工具Skill
Text processing utilities for common operations.
用于常见操作的文本处理工具集。
When to Use
使用场景
✅ USE this skill when:
- "Count words in this text"
- "Convert text to uppercase/lowercase"
- "Remove duplicate lines"
- "Sort lines alphabetically"
- "Find and replace text"
✅ 当你有以下需求时使用本Skill:
- "统计这段文本的字数"
- "将文本转换为大写/小写"
- "移除重复行"
- "按字母顺序排序行"
- "查找并替换文本"
When NOT to Use
不适用场景
❌ DON'T use this skill when:
- Complex regex operations → use sed/awk directly
- File encoding conversion → use iconv
- Binary file processing → use file-specific tools
❌ 以下情况请勿使用本Skill:
- 复杂正则表达式操作 → 直接使用sed/awk
- 文件编码转换 → 使用iconv
- 二进制文件处理 → 使用特定文件工具
Commands
命令
Statistics
统计功能
bash
{baseDir}/text.sh stats <file>
{baseDir}/text.sh stats --stdin < file.txt
echo "text" | {baseDir}/text.sh stats --stdinbash
{baseDir}/text.sh stats <file>
{baseDir}/text.sh stats --stdin < file.txt
echo "text" | {baseDir}/text.sh stats --stdinTransform Case
大小写转换
bash
{baseDir}/text.sh upper <file>
{baseDir}/text.sh lower <file>
{baseDir}/text.sh title <file>
{baseDir}/text.sh sentence <file>bash
{baseDir}/text.sh upper <file>
{baseDir}/text.sh lower <file>
{baseDir}/text.sh title <file>
{baseDir}/text.sh sentence <file>Clean Text
文本清理
bash
{baseDir}/text.sh trim <file>
{baseDir}/text.sh dedup <file>
{baseDir}/text.sh strip-blank <file>
{baseDir}/text.sh normalize-spaces <file>bash
{baseDir}/text.sh trim <file>
{baseDir}/text.sh dedup <file>
{baseDir}/text.sh strip-blank <file>
{baseDir}/text.sh normalize-spaces <file>Sort & Unique
排序与去重
bash
{baseDir}/text.sh sort <file>
{baseDir}/text.sh sort --reverse <file>
{baseDir}/text.sh sort --numeric <file>
{baseDir}/text.sh unique <file>
{baseDir}/text.sh unique --count <file>bash
{baseDir}/text.sh sort <file>
{baseDir}/text.sh sort --reverse <file>
{baseDir}/text.sh sort --numeric <file>
{baseDir}/text.sh unique <file>
{baseDir}/text.sh unique --count <file>Find & Replace
查找与替换
bash
{baseDir}/text.sh replace <file> "old" "new"
{baseDir}/text.sh replace <file> --regex "pat.*tern" "replacement"
{baseDir}/text.sh replace <file> --ignore-case "OLD" "new"bash
{baseDir}/text.sh replace <file> "old" "new"
{baseDir}/text.sh replace <file> --regex "pat.*tern" "replacement"
{baseDir}/text.sh replace <file> --ignore-case "OLD" "new"Encoding
编码
bash
{baseDir}/text.sh encode base64 <file>
{baseDir}/text.sh encode url <file>
{baseDir}/text.sh encode html <file>
{baseDir}/text.sh encode hex <file>bash
{baseDir}/text.sh encode base64 <file>
{baseDir}/text.sh encode url <file>
{baseDir}/text.sh encode html <file>
{baseDir}/text.sh encode hex <file>Decode
解码
bash
{baseDir}/text.sh decode base64 <file>
{baseDir}/text.sh decode url <file>
{baseDir}/text.sh decode html <file>
{baseDir}/text.sh decode hex <file>bash
{baseDir}/text.sh decode base64 <file>
{baseDir}/text.sh decode url <file>
{baseDir}/text.sh decode html <file>
{baseDir}/text.sh decode hex <file>Options
选项
- : Read from stdin instead of file
--stdin - : Write to file instead of stdout
--out <file> - : Use regex pattern for replace
--regex - : Case-insensitive matching
--ignore-case - : Reverse sort order
--reverse - : Numeric sort
--numeric - : Show count with unique
--count
- : 从stdin读取而非文件
--stdin - : 写入文件而非stdout
--out <file> - : 替换时使用正则表达式模式
--regex - : 不区分大小写匹配
--ignore-case - : 反转排序顺序
--reverse - : 数值排序
--numeric - : 显示去重后的计数
--count
Examples
示例
Count words, lines, characters:
bash
{baseDir}/text.sh stats document.txt统计字数、行数、字符数:
bash
{baseDir}/text.sh stats document.txtOutput: Lines: 100, Words: 500, Chars: 3000
Output: Lines: 100, Words: 500, Chars: 3000
**Remove duplicate lines:**
```bash
{baseDir}/text.sh dedup data.txtSort and count duplicates:
bash
{baseDir}/text.sh unique --count log.txt
**移除重复行:**
```bash
{baseDir}/text.sh dedup data.txt排序并统计重复项:
bash
{baseDir}/text.sh unique --count log.txtOutput: 42 error
Output: 42 error
15 warning
15 warning
5 info
5 info
**URL decode:**
```bash
{baseDir}/text.sh decode url --stdin <<< "hello%20world"
**URL解码:**
```bash
{baseDir}/text.sh decode url --stdin <<< "hello%20world"Output: hello world
Output: hello world
undefinedundefinedNotes
注意事项
- All commands can read from stdin with
--stdin - Original files are never modified (output to stdout)
- Use to save to a file
--out
- 所有命令均可通过从stdin读取输入
--stdin - 原始文件不会被修改(输出到stdout)
- 使用选项将结果保存到文件
--out