utility

sed

Apply stream editing commands. s/pattern/replacement/g substitutes all nonoverlapping matches; normal output is stdout. In-place options vary.

Formal Syntax & Structure

bash syntaxbash
sed SCRIPT [FILE ...]

Parameters & Attributes

NameTypeDescription
SCRIPTstringTrusted sed program, quoted in Bash.
FILEpathInput file or stdin.

Return Value

exit status

Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.

Working Example

Example Snippetbash
printf '%s\n' 'draft draft' | sed 's/draft/final/g'
Bash Reference