mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 05:42:09 +02:00
sd: add page (#2810)
This commit is contained in:
parent
3aef0112fc
commit
a30f616f9f
1 changed files with 19 additions and 0 deletions
19
pages/common/sd.md
Normal file
19
pages/common/sd.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# sd
|
||||
|
||||
> `sd` is an intuitive find & replace CLI.
|
||||
|
||||
- Trim some whitespace using regex:
|
||||
|
||||
`{{echo 'lorem ipsum 23 '}} | sd '\s+$' ''`
|
||||
|
||||
- Replace words using capture groups:
|
||||
|
||||
`{{echo 'cargo +nightly watch'}} | sd '(\w+)\s+\+(\w+)\s+(\w+)' 'cmd: $1, channel: $2, subcmd: $3'`
|
||||
|
||||
- Find and replace in a file:
|
||||
|
||||
`sd -i {{'window.fetch'}} {{'fetch'}} {{http.js}}`
|
||||
|
||||
- Find and replace across a project:
|
||||
|
||||
`sd -i {{'from "react"'}} {{'from "preact"'}} $(find . -type f)`
|
Loading…
Add table
Reference in a new issue