Section: Regex with grep

Find blank lines

bash
bash
grep -n '^$' file.txt
Explanation

Helpful for validating formatting or splitting sections.

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 Regex with grep
Use extended regex
Enable `+`, `?`, and alternation without heavy escaping.
OpenIn sheetbashsame section
Match literal text only
Disable regex interpretation.
OpenIn sheetbashsame section
Match line start and end
Search with anchors.
OpenIn sheetbashsame section
Find non-blank lines
Show lines containing at least one non-space character.
OpenIn sheetbashsame section
Search for a word
Print lines containing a pattern.
OpenIn sheetbash1 tag match
Search recursively
Search all files under a directory.
OpenIn sheetbash1 tag match