$ 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
prt -e -tor similar to convert tabs to relative blanks first? Should newlines really be removed as suggested in the question or replaced with blanks? etc., etc.) and concise, testable sample input and expected output. – Ed Morton Jan 29 '21 at 23:11\ts because you aren't runninggsub("\t"," ")on the variable you're printing,hallo, you're running it on$0which you aren't printing. – Ed Morton Jan 29 '21 at 23:32