UseYou can use a keyboard macro. Generally using a keyboard macro means to record some steps for later reuse. (F3Find documentation about keyboard macros within Emacs by entering C-h F kmacro-start-macro-or-insert-counter <RET>.)
Recent versions of Emacs provide the function key <F3> to start a recording of a keyboard macro and F4 mean<F4> to finalize the function keys onrecording and also replay the keyboardlast recording (if not currently recording.)
To solve you question using a keyboard macro perform the following steps.
Move the cursor to the beginning of the line with the 8000 characters.
Act once and record asPress
<F3>(to start macro: recording.)Perform the action. In this case e.g. move forward eight characters (press the left arrow key eight times) and press the enter key.
Press
F3 C-u 8 C-f RET F4<F4>(to finalize the macro recording. The macro then is recorded.)Play itType
M-999 <F4>. Concretely this (typically) means: hold down the Alt key, press the 9-key three times, release the Alt key, press<F4>. Explanation: This plays the macro 999 times:. Recall thatC<F4>replays the previously recorded macro. One can further specify a number how often the macro will be replayed (see the Emacs documentation for "Arguments"). TheM-u 999 F4stands for 999 repetitions.Be patient while the macro performs.
VoilaSee the result of the transformation!