Delete blank lines sed
Remove all empty or whitespace-only lines
sed '/^[[:space:]]*$/d' file.txt
more sed
all 15 commands →
Print specific line numbers
sed -n '10,20p' file.txt
Print lines matching pattern
sed -n '/ERROR/p' app.log
Insert line before match
sed '/^server_name/i # Added by deploy script' nginx.conf
Append line after match
sed '/^\[defaults\]/a ansible_python_interpreter=/usr/bin/python3' ansible.cfg
Case-insensitive substitution
sed 's/error/ERROR/gI' file.txt