Raw Input
1 3 5 7 9 1 3 5 7 9
Desired Output
1_3_5_7_9 1 3 5 7 9
Script and Comments
Script1
[ 1] s/.\{8\}/&\n/
[ 2] :loop
[ 3] s/ \(.*\n\)/_\1/
[ 4] t loop
[ 5] s/\n//
Comments
  1. We use step [1] to insert a newline character after the 8th character. This newline character is used as a marker.
  2. Step [2] thru [4] constitute a loop. This loop will replace each space character before the marker with an underscore.
  3. Step [5] will remove the marker.