GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SD(1) FreeBSD General Commands Manual SD(1)

sd

sd [FLAGS] find replace_with [FILES]

-p, --preview
Emit the replacement to STDOUT

-s, --string-mode
Treat expressions as non-regex strings.

-f, --flags
Treat expressions as non-regex strings. /** Regex flags. May be combined (like `-f mc`).

c - case-sensitive i - case-insensitive m - multi-line matching w - match full words only

0
Successful program execution.

1
Unsuccessful program execution.

101
The program panicked.

String-literal mode
$ echo 'lots((([]))) of special chars' | sd -s '((([])))' ''
lots of special chars
Regex use. Let's trim some trailing whitespace
$ echo 'lorem ipsum 23 ' | sd '' ''
lorem ipsum 23
Indexed capture groups
$ echo 'cargo +nightly watch' | sd '(0(24
cmd: cargo, channel: nightly, subcmd: watch
Named capture groups
$ echo "123.45" | sd '(?P<dollars>+).(?P<cents>+)' '$dollars dollars and $cents cents'
123 dollars and 45 cents
Find & replace in file
$ sd 'window.fetch' 'fetch' http.js
Find & replace from STDIN an emit to STDOUT
$ sd 'window.fetch' 'fetch' < http.js


Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.