sed one-liners explained, this one is outstanding: Famous Sed One-Liners Explained, Part I: File Spacing, Numbering and Text Conversion and Substitution
stumbled upon this while trying to paginate text with (gnu) sed, aka reformatting text to a given line width. suppose you want to add linebreaks to a text so no line is longer than, say, 4 characters:
echo “0123456789ABCDEFGH” | sed ‘s/.\{4\}/&\
/g’