Address range substitution
Apply substitution only to lines 5 through 15
sed '5,15s/DEBUG/INFO/g' app.log
- tool
- sed15 commands
More sed commands
-
sed -n 's/^DB_HOST=//p' .envPrint the value of DB_HOST from a .env file
-
sed 's/foo/bar/' file.txtReplace the first occurrence of 'foo' with 'bar' per line
-
sed 's/foo/bar/g' file.txtReplace every occurrence per line with the /g flag
-
sed -i 's/old/new/g' config.cfgModify file in-place (no backup); on macOS add empty string: -i ''
-
sed -i.bak 's/old/new/g' file.txtEdit in-place and save original as file.txt.bak