sed

, and

Syntax

sed [options] 'command' file

Parameters

ParametersDescriptionExamplesLevel
-i () Common
-n , Common
-e command Common
-E Common
g () Common

Examples

old new

sed 's/old/new/g' file.txt

sed -i 's/localhost/127.0.0.1/g' config.yml

10 20

sed -n '10,20p' file.txt

( # )

sed '/^#/d' config.conf

sed -i '/^$/d' file.txt

| ()

sed 's|/usr/local|/opt|g' paths.txt

Tips

Related Commands