Run several expressions
Apply several replacements in one command
sed -e 's/foo/bar/g' -e 's/baz/qux/g' file.txt
- tool
- sed15 commands
More sed commands
-
sed 's/^[[:space:]]*//;s/[[:space:]]*$//' file.txtRemove spaces at the start and end of each line
-
sed '5,15s/DEBUG/INFO/g' app.logApply the replacement only to lines 5-15
-
sed -n 's/^DB_HOST=//p' .envPrint the DB_HOST value from a .env file
-
sed 's/foo/bar/' file.txtReplace the first "foo" with "bar" in each line
-
sed 's/foo/bar/g' file.txtReplace every match in each line with the /g flag