find-replace
SolidModern find-and-replace using sd (simpler than sed) and batch replacement patterns. Triggers on: sd, find replace, batch replace, sed replacement, string replacement, rename.
AI & Automation 400 stars
39 forks Updated today
Install
Quality Score: 83/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Find Replace
Modern find-and-replace using sd.
## sd Basics
```bash
# Replace in file (in-place)
sd 'oldText' 'newText' file.txt
# Replace in multiple files
sd 'oldText' 'newText' *.js
# Preview without changing (pipe)
cat file.txt | sd 'old' 'new'
```
## sd vs sed
| sed | sd |
|-----|-----|
| `sed 's/old/new/g'` | `sd 'old' 'new'` |
| `sed -i 's/old/new/g'` | `sd 'old' 'new' file` |
| `sed 's#path/to#new/path#g'` | `sd 'path/to' 'new/path'` |
**Key difference:** sd is global by default, no delimiter issues.
## Common Patterns
```bash
# Variable/function rename
sd 'oldName' 'newName' src/**/*.ts
# Word boundaries (avoid partial matches)
sd '\boldName\b' 'newName' src/**/*.ts
# Import path update
sd "from '../utils'" "from '@/utils'" src/**/*.ts
# Capture groups
sd 'console\.log\((.*)\)' 'logger.info($1)' src/**/*.js
```
## Safe Batch Workflow
```bash
# 1. List affected files
rg -l 'oldPattern' src/
# 2. Preview replacements
rg 'oldPattern' -r 'newPattern' src/
# 3. Apply
sd 'oldPattern' 'newPattern' $(rg -l 'oldPattern' src/)
# 4. Verify
rg 'oldPattern' src/ # Should return nothing
git diff # Review changes
```
## Special Characters
| Character | Escape |
|-----------|--------|
| `.` | `\.` |
| `*` | `\*` |
| `[` `]` | `\[` `\]` |
| `$` | `\$` |
| `\` | `\\` |
## Tips
| Tip | Reason |
|-----|--------|
| Always preview with `rg -r` first | Avoid mistakes |
| Use git before bulk changes | Easy rollback |
| Use `\b` for word boundaries | Avo...
Details
- Author
- aiskillstore
- Repository
- aiskillstore/marketplace
- Created
- 7 months ago
- Last Updated
- today
- Language
- Python
- License
- None
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Listed
tool-sd
Use sd for fast, readable search-and-replace in files with safer defaults than sed. Trigger when batch textual replacements are needed across files.
1 Updated today
niksavis Data & Documents Solid
file-search
Modern file and content search using fd, ripgrep (rg), and fzf. Triggers on: fd, ripgrep, rg, find files, search code, fzf, fuzzy find, search codebase.
400 Updated today
aiskillstore AI & Automation Listed
tool-ast-grep
Use ast-grep for structural code search and rewrite based on syntax trees. Trigger when text search is too imprecise for code-aware matching.
1 Updated today
niksavis