text

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Text Processing Skill

文本处理技能

Process text files using standard bash tools (grep, sed, awk, wc).
使用标准bash工具(grep、sed、awk、wc)处理文本文件。

Available Scripts

可用脚本

stats.sh

stats.sh

Get statistics about a text file (lines, words, characters).
bash
bash /skills/text/scripts/stats.sh document.txt
获取文本文件的统计信息(行数、单词数、字符数)。
bash
bash /skills/text/scripts/stats.sh document.txt

search.sh

search.sh

Search for patterns in text files.
bash
bash /skills/text/scripts/search.sh <file> <pattern> [--count] [--context <lines>]
在文本文件中搜索匹配模式。
bash
bash /skills/text/scripts/search.sh <file> <pattern> [--count] [--context <lines>]

extract.sh

extract.sh

Extract specific lines or sections from a file.
bash
bash /skills/text/scripts/extract.sh <file> --lines <start>-<end>
bash /skills/text/scripts/extract.sh <file> --between <start_pattern> <end_pattern>
从文件中提取特定行或片段。
bash
bash /skills/text/scripts/extract.sh <file> --lines <start>-<end>
bash /skills/text/scripts/extract.sh <file> --between <start_pattern> <end_pattern>

wordfreq.sh

wordfreq.sh

Count word frequencies in a text file.
bash
bash /skills/text/scripts/wordfreq.sh document.txt [--top <n>]
统计文本文件中的词频。
bash
bash /skills/text/scripts/wordfreq.sh document.txt [--top <n>]

Examples

示例

bash
undefined
bash
undefined

Get file statistics

获取文件统计信息

bash /skills/text/scripts/stats.sh readme.txt
bash /skills/text/scripts/stats.sh readme.txt

Search with context

带上下文搜索

bash /skills/text/scripts/search.sh log.txt "ERROR" --context 2
bash /skills/text/scripts/search.sh log.txt "ERROR" --context 2

Extract lines 10-20

提取第10-20行

bash /skills/text/scripts/extract.sh file.txt --lines 10-20
bash /skills/text/scripts/extract.sh file.txt --lines 10-20

Top 10 most frequent words

统计排名前10的高频词

bash /skills/text/scripts/wordfreq.sh article.txt --top 10
undefined
bash /skills/text/scripts/wordfreq.sh article.txt --top 10
undefined