Linux sed and awk Cheat Sheet/Delete comment lines

Skip lines that begin with `#`.

Section: sed Line Deletion and Printing

Delete comment lines

bash
bash
sed '/^[[:space:]]*#/d' config.ini
Explanation

Especially useful for previewing meaningful config lines only.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed Line Deletion and Printing
Delete blank lines
Remove empty lines from output.
OpenIn sheetbashsame section
Delete a line range
Remove lines 5 through 10.
OpenIn sheetbashsame section
Print only matching lines
Use sed as a pattern filter.
OpenIn sheetbashsame section
Print a line range only
Show lines 5 through 10.
OpenIn sheetbashsame section
Replace first occurrence per line
Substitute one match in each line.
OpenIn sheetbash1 tag match
Replace all occurrences per line
Substitute every match on each line.
OpenIn sheetbash1 tag match