SD(1)

NAME
sd

SYNOPSIS
sd [FLAGS] find replace_with [FILES]

FLAGS

-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

EXIT STATUS

0   Successful program execution.

1   Unsuccessful program execution.

101 The program panicked.

EXAMPLES

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 '(+((
    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