sed
Skill4 starsChanged 6 months agoMITView on GitHub
Fast, non-interactive text stream editing and precise file segment extraction using sed.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- bastos/skillstheir own version, first seen Jan 30, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- bastos/skills★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Construct the One-Liner: Use standard sed syntax. Do not use interactive tools.
- Very specific: line 30
Validate Locally: Run without -i (in-place) first if modifying files, or strictly use read-only modes like -n.
- Distinctive: line 36
Use this to extract a precise segment of a file (e.g., lines 80 to 95) without dumping the whole file.
- Very specific: line 64
Remove leading and trailing whitespace from each line.
- Very specific: line 127
When modifying files directly, use -i (or -i.bak to create backups on some OS).
- Very specific: line 136
Prefer
sed -n: Always suppress default output when extracting segments to prevent flooding the terminal. - Very specific: line 137
Quote Safely: Use single quotes '...' for sed commands to avoid shell expansion issues, unless you intentionally need variable expansion …
- Distinctive: line 138
Non-Interactive First: Never assume human intervention is possible.
- Very specific: line 147
Avoid using sed to edit JSON, YAML, or XML files when structured tools like jq or yq are available.
- Very specific: line 148
Do not use sed to edit source code AST when specialized formatting/refactoring tools exist.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: sed
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Fast, non-interactive text stream editing and precise file segment extraction using sed.
When to Use This Skill
- You need to extract specific line ranges from a large file without reading the whole file into memory.
- You need to perform non-interactive, programmatic find-and-replace across files.
- You are writing shell scripts or processing streams of data in pipelines.
- You want to extract snippets of log files or codebase for context extraction.
When Not to Use
- Parsing or modifying complex structured data formats (JSON, YAML, XML) where context-aware tools (
jq,yq) are significantly safer. - Making multi-line replacements with complex indentation rules where
ex(Vim) or Python scripting is more robust. - Interactive text editing.
Core Process
- Identify the Target Range or Pattern: Determine the start and end line numbers or regex boundaries.
- Construct the One-Liner: Use standard
sedsyntax. Do not use interactive tools. - Validate Locally: Run without
-i(in-place) first if modifying files, or strictly use read-only modes like-n.
Essential One-Liners
1. Extract a Specific Line Range
Use this to extract a precise segment of a file (e.g., lines 80 to 95) without dumping the whole file.
sed -n '80,95p' <file>2. Extract Lines Between Two Regex Patterns
Extract text between two known boundary strings (inclusive).
sed -n '/START_PATTERN/,/END_PATTERN/p' <file>3. Replace a String (First Occurrence Per Line)
sed 's/old/new/' <file>4. Replace a String (All Occurrences Per Line)
sed 's/old/new/g' <file>5. Text Cleaning (Trim Spaces)
Remove leading and trailing whitespace from each line. Note: \t for tabs is a GNU extension; use literal tabs or [[:blank:]] for portability.
# Trim leading spaces and tabs (GNU)
sed -e 's/^[ \t]*//g' <file>
# Trim trailing spaces and tabs (GNU)
sed -e 's/[ \t]*$//g' <file>
# Combined trim (Portable/POSIX)
sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' <file>6. Case Conversion
Note: \u and \U are GNU sed extensions and are not portable (e.g., on macOS/BSD).
# Capitalize first character of each line (GNU)
sed 's/./\u&/' <file>
# Capitalize first character of every word (GNU)
sed -E 's/\b[a-z]/\U&/g' <file>7. Structure and Reordering
# Swap first and last characters of each line (Extended Regex)
# Handles 2+ characters; 1-character lines remain unchanged.
sed -E 's/(.)(.*)(.)/\3\2\1/' <file>8. Content Extraction and Conversion
# Remove all XML/HTML tags
sed -e 's/<[^>]*>//g' <file>
# Convert XML/HTML tags to newlines (GNU: \n)
# Portable sed requires a literal escaped newline in the replacement.
sed -e 's/<[^>]*>/\n/g' <file>
# WIF to SHA (part of a pipeline)
base58 -d | xxd -p -c200 | sed s/^80// | rg -oz "[A-Fa-f0-9]{64}"9. System and Database Fixes
# Recursive directory tree visualization (simplified)
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
# List 40 largest files (recursive) - more precise than ls -R
find . -type f -exec du -h {} + | sort -hr | head -n40
# MySQL Collation Fix (Use with caution: may downgrade utf8mb4 to utf8)
# Only use if the target database does not support utf8mb4.
sed "s/utf8mb4_0900_ai_ci\|utf8mb4_unicode_ci/utf8_general_ci/g;s/\butf8mb[34]/utf8/g" <dump.sql>10. In-Place Edit (With Safety)
When modifying files directly, use -i (or -i.bak to create backups on some OS). Note: GNU sed supports -i directly, but macOS/BSD sed requires -i ''.
# GNU sed (Linux)
sed -i 's/old/new/g' <file>Core Principles
- Prefer
sed -n: Always suppress default output when extracting segments to prevent flooding the terminal. - Quote Safely: Use single quotes
'...'for sed commands to avoid shell expansion issues, unless you intentionally need variable expansion (in which case use double quotes"..."carefully). - Non-Interactive First: Never assume human intervention is possible.
Common Pitfalls
- macOS/BSD vs. GNU
sed: macOSsed -irequires an extension argument (likesed -i '' 's/old/new/g' file), whereas Linux (GNU)sedallows-iwithout an extension. Since the agent primarily runs on Linux,sed -iis usually safe, but be cautious of cross-platform scripts. - Regex Dialects: By default,
seduses Basic Regular Expressions (BRE). You must escape+,?,|,(,),{,}. To use Extended Regular Expressions (ERE), pass the-Eflag (e.g.,sed -E 's/(foo|bar)/baz/g').
What to Avoid
- Avoid using
sedto edit JSON, YAML, or XML files when structured tools likejqoryqare available. - Do not use
sedto edit source code AST when specialized formatting/refactoring tools exist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

