$ awk 'length > 72' {HOW TO PRINT THE LINEs IN PCS?} msg
ie I want it to add \n after 72 chars and continue, so initially you may need to remove all single \ns and the add them. It may be easier be easier with other tool but let's give a try to awk.
[Update]
Williamson provided the right answer but some help needed to read it. I break the problem into parts with simpler examples, below.
Why does the code below print
\tin both cases,gsubshould substitute things? x is a dummy-file, some odd 0 at the end.Attacking the line
line = $0 \n more = getline \n gsub("\t"," ")in Williamson's reply,lineapparently gets whole stdout whilemoregets popped value of$0, right?
Code to part 1
$ gawk '{ hallo="tjena\t tjena2"; gsub("\t"," "); }; END {print hallo; gsub("\t", ""); hallo=hallo gsub("\t",""); print hallo }' x
tjena tjena2
tjena tjena20