Yes, I could do this easily in perl or awk (if I had even bothered, as even
these I have rusted out on) but I wanted to refresh my sed and found myself
stuck at how to compose such a beast ...
So, I'm obviously after the most elegant and least convoluted solution that you may come up with ... no hurry either!
I was surprised that no loop is needed. The explanation is that D jumps to the next cycle if there is another line, and the insertion of a newline has just created it!
Thanks to all of you for your very prompt replies.
A true pack of wizards ... the lot of you!
Particular thanks go to Yoda as just last night my 6 y/o daughter and I were humming the Empire Strike tune ( I think it's that one) and when I asked her
who was her favourite character ... she said Yoda!
$ type -a fold paste
fold is /usr/bin/fold
paste is /usr/bin/paste
$ man fold paste
both are part of coreutils, ... Wow!
I don't recall knowing these handy tools!
I'm sure I must have glanced over them years ago
when I used to be more into this stuff, but if you
don't ever use them you may not even know these exist!
Yes, the general UNIX toolkit is full of useful, interesting and on-point
utilities!!!