jyasuu/cheat-sheet/sed

Claude Code and agent skill by jyasuu/cheat-sheet

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Stream editor for text substitution, line operations, and file transformations.

Install

npx vskill@latest install jyasuu/cheat-sheet/sed

SKILL.md

The same SKILL.md was published earlier as jyasuu/cheat-sheet/sed.

sed — Stream Editor

Basic Substitution

bash
# Replace all occurrences of "day" with "night"
sed 's/day/night/g' file.txt
# Replace first occurrence per line
sed 's/day/night/' file.txt
# Preview substitution without changes
sed 's/Name=Xfce Session/Name=Xfce_Session/' FILE
# Edit file in-place
sed -i 's/day/night/g' file.txt
# Edit with backup
sed -i.bak 's/day/night/g' file.txt

Special Characters & Delimiters

bash
# Escape slashes in paths
sed -i 's/\/path\/to\/somewhere\//\/path\/to\/anotherplace\//' FILE
# Use pipe as delimiter to avoid escaping slashes
sed -i 's|/path/to/somewhere/|/path/to/anotherplace/|' FILE
# Replace tabs with 4 spaces
sed -i 's/\t/ /g' FILE

Line Operations

bash
# Print 2nd line
sed -n '2p' FILE
# Print lines from 2 to 9
sed -n '2,9p' FILE
# Print last line
sed -n '$p' FILE
# Print line 5 and quit
sed -n '5{p;q}' FILE
# Print and quit at 3rd line
sed -n 'p;3q'
# Print lines starting from pattern until line 17
sed -n '/any/,17p' FILE
# Print between two patterns
sed -n '/strstart/,/strend/p' FILE

Line Endings

bash
# Convert CRLF to LF (Windows to Linux)
sed -i 's/\r$//g' FILE
# Convert LF to CRLF (Linux to Windows)
sed -i 's/$/\r/' FILE
# Remove carriage return (original example)
sed -i 's/\r//g' FILE

Whitespace & Formatting

bash
# Remove trailing spaces
sed -i -E "s/\s+$//g" FILE
# Remove leading spaces
sed -i -r 's/^\s+//g' FILE
# Remove empty lines
sed -i -E "/^\s*$/d" FILE
# Remove both leading and trailing spaces
sed -i -E 's/^\s+|\s+$//g' FILE

Advanced Transformations

bash
# Rearrange date format YYYY-MM-DD to DD-MM-YYYY
echo '2024-01-22' | sed -E "s/([0-9]{4})-([0-9]{2})-([0-9]{2})/\3-\2-\1/"
# Anonymize MAC addresses
ifconfig | sed -E "/ether s/([0-9a-f]{2}:{0,1}){6}/00:00:00:00:00:00/g"
# Delete specific lines
sed -i '/pattern_to_match/d' file.txt
# Insert line before matching
sed -i '/pattern/i\New line text' file.txt
# Append line after matching
sed -i '/pattern/a\New line text' file.txt

Multiple Commands

bash
# Multiple substitutions
sed -i -e 's/foo/bar/g' -e 's/baz/qux/g' file.txt
# Use semicolon for multiple commands
sed -i 's/a/b/; s/c/d/' file.txt
# Read commands from file
sed -i -f script.sed file.txt

In-Place Examples

bash
# Delete lines 1-5
sed -i '1,5d' file.txt
# Delete lines containing "pattern"
sed -i '/pattern/d' file.txt
# Delete blank lines
sed -i '/^$/d' file.txt
# Replace in all .txt files
find . -name "*.txt" -exec sed -i 's/old/new/g' {} \;

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/jyasuu/cheat-sheet/sed/badge)](https://verified-skill.com/skills/jyasuu/cheat-sheet/sed)

Something wrong with this skill or its page? Tell us.