#!/usr/bin/sed # Convert unlabelled code # # Code output by action=markdown ends with two spaces (mostly). / $/,/\[Get Code]/ { # At the end of the block dump the accumulated lines /\[Get Code\]/ { x p x d } # clean whitespace s/\s\+$// # indent s/^/ / # accumulate lines within the code block H d }