In place replacements

In GNU sed: use -i without arg.

sed -i -e 's/foo/bar/' example.md

In OSX, -i '' is required.

sed -i '' -e 's/foo/bar/' example.md

File regions

sed '/begin api/q'
sed '/^# begin/,$d'
sed -n '/end api/,$p'