logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Description

Examples

       String-literal mode
              $echo'lots((([])))ofspecialchars'|sd-s'((([])))'
              lots of special chars

       Regex use. Let's trim some trailing whitespace
              $echo'loremipsum23'|sd'\s+$'''
              lorem ipsum 23

       Indexed capture groups
              $echo'cargo+nightlywatch'|sd'(\w+)\s+\+(\w+)\s+(\w+)''cmd:$1,channel:$2,subcmd:$3'
              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

                                                    sd 1.0.0                                               sd(1)

Exit Status

       0      Successful program execution.

       1      Unsuccessful program execution.

       101    The program panicked.

Name

       sd

Options

-p, --preview
              Display changes in a human reviewable format (the specifics of the format are likely to change  in
              the future)

       -F, --fixed-strings
              Treat FIND and REPLACE_WITH args as literal strings

       -n, --max-replacements=LIMIT [default: 0]
              Limit the number of replacements that can occur per file. 0 indicates unlimited replacements

       -f, --flags=FLAGS
              Regex flags. May be combined (like `-f mc`).

              c - case-sensitive

              e - disable multi-line matching

              i - case-insensitive

              m - multi-line matching

              s - make `.` match newlines

              w - match full words only

       -h, --help
              Print help (see a summary with '-h')

       -V, --version
              Print version

       <FIND> The regexp or string (if using `-F`) to search for

       <REPLACE_WITH>
              What  to  replace each match with. Unless in string mode, you may use captured values like $1, $2,
              etc

       [FILES]
              The path to file(s). This is optional - sd can also read from STDIN.

              Note: sd modifies files in-place by default. See documentation for examples.

Synopsis

sd  [-p|--preview]  [-F|--fixed-strings]  [-n|--max-replacements] [-f|--flags] [-h|--help] [-V|--version]
       <FIND> <REPLACE_WITH> [FILES]

See Also