Am Thu, 9 Aug 2018 21:21:11 -0400 schrieb sl@stanleylieber.com: > Previous message garbled. Full article here: > > http://plan9.stanleylieber.com/werc/apps/wman/linewraps > > sl Writing that with some reservation because currently only using plan9port (will have to repair my p9 system): When setting RS to \0 awk is taking paragraphs separated by empty lines each time, so I simply iterated over a whole paragraph each time. Problems are, that (1) gsub doesn't have sub-patterns and gensub isn't available, so I had to do all by hand: awk -v RS='\0' 'function stripoff(str, num) { str = substr(str, num, length(str)-num+1) sub("^ *", "", str) return str } /[a-z]-\n *[a-z]/ { for (s=$0; i=index(s, "-\n "); s=stripoff(s, i+2)) { printf("%s",substr(s,1,i-1)) } print s "\n" next } 1' So maybe it's also possible to integrate the following sed and awk stuff there - I'd try it if the above is of any help. -- :)