sd is an intuitive find & replace CLI (sed alternative).

# To trim some whitespace using regex:
<echo 'lorem ipsum 23   '> | sd '\s+$' ''

# To replace words using capture groups:
<echo 'cargo +nightly watch'> | sd '(\w+)\s+\+(\w+)\s+(\w+)' 'cmd: $1, channel: $2, subcmd: $3'

# To find and replace in a file:
sd -i <'window.fetch'> <'fetch'> <http.js>

# To find and replace across a project:
sd -i <'from "react"'> <'from "preact"'> $(find . -type f)