awk '!/^([[:space:]]*#.*)?$/' testfile
testfile
:
Beginning line
Line starts with spaces
# Comment line
# Comment line starts with spaces
Line # with a comment
2 empty lines below
Ending line
Beginning line
Line starts with spaces
Line # with a comment
2 empty lines below
Ending line
awk '!/^([[:space:]]*#.*)?$/ {$1=$1;print}' testfile
Beginning line
Line starts with spaces
Line # with a comment
2 empty lines below
Ending line