% sed -rn 's/^### ?//;T;p' testfile
sed: 1: "s/^### ?//;T;p": invalid command code T
Looks like it might need GNU Sed or something. But honestly if I want to read the top of the file less works just as well.
You could do the same thing with awk instead:
awk '{ if (sub("^### ?", "")) { print; } else { exit; } }'
Perl for example was made for problems like this.
perl -ne 'print if ( s/^### ?// )'
sed -rn 's/^### ?//p'
sed -n '/^### /p'
Then eg:
sed -nr '/^### /s/^.{4}(.*)/\1/p'
sed -nr 's/^### (.*)/\1/p'
sed -nr 's/^.{4}(.*)/\1/'
sed -nr 's/^.{4}//
sed -nr '/^### /s/^.{4}//p'
sed -nr '/^### /s///p'
sed -nr 's/^### //p'
You could do the same thing with awk instead: