← Back to Skills Marketplace
openlang-cn

J

by openlang · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
258
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install j
Description
Short alias skill for joining, merging, or combining files, data, or strings. Use when you need to concatenate or merge content from multiple sources.
README (SKILL.md)

j(Join 简写)

这是一个快速"合并" 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 $'	' -1 1 -2 1 file1 file2  # 指定分隔符和字段

文本合并

行转列

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

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

# 不同分隔符
sed ':a;N;$!ba;s/\
/ /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 '\
' '&')

构建请求体

# 合并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 技能帮你无缝衔接碎片化的内容。记住:合并前先备份,合并后做验证!

Usage Guidance
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 untrusted files (the Node example reads and parses JSON). If you need the agent to operate autonomously, confirm it has explicit, limited file access so it cannot read sensitive files by accident.
Capability Analysis
Type: OpenClaw Skill Name: j Version: 1.0.0 The 'j' skill bundle is a collection of standard command-line snippets and instructions for merging files, strings, and data formats like JSON and CSV. It provides legitimate usage examples for common utilities such as cat, awk, jq, and sed, as well as a simple Node.js script for JSON merging. No malicious intent, data exfiltration, or suspicious obfuscation was found in SKILL.md or _meta.json.
Capability Assessment
Purpose & Capability
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.
Instruction Scope
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.
Install Mechanism
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.
Credentials
The skill requires no environment variables, credentials, or config paths. There are no unexplained secret requests or access to unrelated services.
Persistence & Privilege
always is false and the skill has no install/persistence behavior. It does not request elevated or permanent presence in the agent environment.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install j
  3. After installation, invoke the skill by name or use /j
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- 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.
Metadata
Slug j
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is J?

Short alias skill for joining, merging, or combining files, data, or strings. Use when you need to concatenate or merge content from multiple sources. It is an AI Agent Skill for Claude Code / OpenClaw, with 258 downloads so far.

How do I install J?

Run "/install j" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is J free?

Yes, J is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does J support?

J is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created J?

It is built and maintained by openlang (@openlang-cn); the current version is v1.0.0.

💬 Comments