Sed one-liner to print specific lines?

I need to print specific lines from a file, say 2-5, 8, 12-15, 17, 19, 21-27. How do I achieve this?

sed -n '2,5p; 8p; 12,15p; 17p; 19p; 21,27p' infile

Sed - An Introduction and Tutorial

Thanks!