Append line after match sed
Append a setting line after the [defaults] header
sed '/^\[defaults\]/a ansible_python_interpreter=/usr/bin/python3' ansible.cfg
more sed
all 15 commands →
Case-insensitive substitution
sed 's/error/ERROR/gI' file.txt
Multiple expressions
sed -e 's/foo/bar/g' -e 's/baz/qux/g' file.txt
Strip leading/trailing whitespace
sed 's/^[[:space:]]*//;s/[[:space:]]*$//' file.txt
Address range substitution
sed '5,15s/DEBUG/INFO/g' app.log
Extract value from key=value file
sed -n 's/^DB_HOST=//p' .env