79780119

Date: 2025-10-01 13:35:53
Score: 0.5
Natty:
Report link

I also needed this functionality but in an environment without Python nor additional downloadable tools.

I ended up with the following solution using awk only.

cat myfile.md |awk '{if ($0~/^## /) {++count} if (count>1) {exit} print $0}'

It will stop printing lines after the second ## header 2 is found.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: henyxia