首页龙虾技能列表 › J — 技能工具

J — 技能工具

v1.0.0

[自动翻译] Short alias skill for joining, merging, or combining files, data, or strings. Use when you need to concatenate or merge content from multiple sources.

0· 196·0 当前·0 累计
by @openlang-cn (openlang)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/12
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
This is an instruction-only helper for joining/merging files and strings; its instructions match the stated purpose and it requests no credentials or installs.
评估建议
This skill is a documentation/cheatsheet for merging files and strings — it does not install anything or ask for secrets. Before using it, ensure: (1) you run the shown commands only on files you intend to merge (they will read and potentially overwrite output files), (2) backup originals before bulk operations, (3) required external tools (jq, csvstack/csvjoin, pandoc, node, iconv) are present on your system if you plan to use those examples, and (4) be cautious about running example scripts on...
详细分析 ▾
用途与能力
The name and description (join/merge/concatenate) match the SKILL.md content: examples show cat, paste, join, jq, simple Node script, csv tools, pandoc, iconv, etc. Nothing requested or described suggests capabilities beyond file/data merging.
指令范围
The instructions explicitly tell the agent to read and concatenate local files and run local commands (cat, paste, awk, jq, node, etc.), which is expected for this purpose. This does mean the agent will read any files you ask it to merge and may run a Node script example; the doc does not instruct access to unrelated system paths or external endpoints.
安装机制
No install spec (instruction-only), so nothing is written to disk by the skill itself — lowest install risk. Note: the examples reference external tools (jq, csvstack/csvjoin, pandoc, iconv, node) that are not installed by the skill; the agent environment must already have them available to run those commands.
凭证需求
The skill requires no environment variables, credentials, or config paths. There are no unexplained secret requests or access to unrelated services.
持久化与权限
always is false and the skill has no install/persistence behavior. It does not request elevated or permanent presence in the agent environment.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/12

- Initial release of the **j** skill for quickly joining, merging, or combining files, data, or strings. - Provides concise command examples covering file, text, JSON, CSV/TSV, code files, and URL/parameter merging. - Includes practical tips on sorting, deduplication, encoding, and handling large files. - Offers advanced techniques with common CLI tools (cat, paste, awk, jq, etc.) for robust merging operations. - Skill guide features clear usage scenarios and best practices for safe and efficient content merging.

● 无害

安装命令 点击复制

官方npx clawhub@latest install j
镜像加速npx clawhub@latest install j --registry https://cn.clawhub-mirror.com

技能文档

这是一个快速"合并" Skill,用字母 j 触发。用于拼接文件、合并数据、连接字符串,让分散的内容重新组合。


适用场景

当你说:

  • "合并这两个文件"
  • "把多行合并成一行"
  • "join these csv files"
  • "concatenate files"
  • "combine strings"
  • "merge JSON files"

文件合并

cat(拼接)

cat file1.txt file2.txt > combined.txt  # 合并两个文件
cat .log > all.log                     # 合并所有log
cat part > full.txt                    # 合并part开头的文件

paste(列合并)

paste file1.txt file2.txt              # 按列合并
paste -d ',' file1.txt file2.txt      # 指定分隔符
paste -s file.txt                      # 行转列(单行输出)

awk高级合并

awk 'FNR==NR{a[$1]=$2;next}{print $0,a[$1]}' file1 file2  # 基于字段合并
join file1 file2                       # 基于共同字段连接(需排序)
join -t $'\t' -1 1 -2 1 file1 file2  # 指定分隔符和字段

文本合并

行转列

# 多行变单行(空格分隔)
cat file.txt | tr '\n' ' '

# 逗号分隔 paste -sd ',' file.txt

# 不同分隔符 sed ':a;N;$!ba;s/\n/ /g' file.txt

去重合并

cat file1.txt file2.txt | sort | uniq > merged.txt
cat file.txt | sort -u > unique.txt

JSON合并

jq工具

# 合并两个JSON数组
jq -s 'add' file1.json file2.json

# 合并对象(深合并) jq -s 'reduce .[] as $item ({}; . $item)' file1.json file2.json

# 合并数组到对象(按key) jq -s 'from_entries' file1.json file2.json

Node.js脚本

// merge.js
const fs = require('fs');
const files = process.argv.slice(2);
const result = files.map(f => JSON.parse(fs.readFileSync(f, 'utf8')));
console.log(JSON.stringify(result, null, 2));
node merge.js file1.json file2.json

CSV/TSV处理

# 合并CSV(跳过header)
tail -q -n +2 file1.csv file2.csv > combined.csv

# 垂直合并(相同列结构) csvstack file1.csv file2.csv > merged.csv

# 水平合并(相同行数) csvjoin -c id file1.csv file2.csv > merged.csv


代码文件合并

# 合并多个JS文件(加注释分隔)
for f in .js; do echo "// === $f ===" >> bundle.js; cat "$f" >> bundle.js; done

# 压缩合并(去除空行和注释) cat .js | sed '/^\s\/\//d' | sed '/^\s$/d' > bundle.min.js

# 按字母顺序 ls .js | sort | xargs cat > bundle.js


URL/参数合并

bash参数处理

# 合并数组
array=($(cat list.txt))
merged="${array[@]}"

# 合并多行参数 params=$(cat params.txt | tr '\n' '&')

构建请求体

# 合并JSON参数
jq -n --arg a "$(cat a.json)" --arg b "$(cat b.json)" '{a:$a, b:$b}'

技巧与陷阱

保持顺序

# 按文件名顺序合并
ls -1v .txt | xargs cat > merged.txt  # -v: 自然排序

大文件处理

# 流式合并(内存友好)
cat large1.txt large2.txt | gzip > merged.gz

编码问题

# 统一编码为UTF-8
iconv -f GBK -t UTF-8 file.txt > file_utf8.txt
cat .txt | iconv -f GBK -t UTF-8 > merged.txt

实用单行

# 合并所有Markdown为PDF(需pandoc)
pandoc .md -o combined.md

# 合并日志并按时间排序(按文件名) ls -t .log | xargs cat > chrono.log

# 合并并统计总行数 cat .txt | wc -l


j 技能帮你无缝衔接碎片化的内容。记住:合并前先备份,合并后做验证!

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务