🧀 Learn Linux

Master·Read and process text

sed: Replace text or select lines

Put in free practice

Syntax

sed [-in] expression [file…]

Options

-i
Modify files directly
-n
Output only explicitly selected lines

Examples

sed -i "s/DEBUG=true/DEBUG=false/" /etc/app.conf

Usage and sandbox support

Supported subset: s/OLD/NEW/g and n[,m]p. See the official manual for complex scripts and GNU/BSD differences.

Hands-on exercises

Full documentation ↗

Related commands