Related to How to join vCards lines, vCard does a weird kind of line splitting: If a line contains more than 75 characters, insert a "CR, LF, space" sequence. Thus the following line:
123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789S123456789U123456789V123456789W123
should be split into the following lines:
123456789A123456789B123456789C123456789D123456789E123456789F123456789G12345
6789H123456789I123456789J123456789K123456789L123456789M123456789N123456789
O123456789P123456789Q123456789R123456789S123456789U123456789V123456789W123
You can't just insert the line split sequence every 75 characters, because then there would be more than 75 characters per line again, and you can't just insert after counting 75 characters because it should only be inserted if the line is longer than 75 characters. One way to do it is to repeat the following command until the input no longer changes:
sed -e 's/^\(.\{75\}\)\([^\r]\)/\1\r\n \2/' < file | sed -e '...' | ...
That's obviously not going to work with indeterminately long lines, and is horribly inefficient. How would you do this sort of replacement?