http://qs321.pair.com?node_id=870024


in reply to Skip 2 new lines

and yet another approach = first replace all \n\n with a special character or character sequence that won't appear in normal text. then do whatever you want to do with single \n's and whatever other processing. then finally expand out the special character or sequence back to \n\n. this is a bit long winded, but doesn't fall into the traps of complex regular expressions that can trip up when you're not looking.
the hardest line to type correctly is: stty erase ^H