echo -e 'zero\none\ntwo three' | perl -0777 -pe 's{\s*(one\ntwo)\s*^( *)}{\n\n\n\n$1\n\n\n\n$2}m' zero one two three