Manipulating strings

My brain is melting, maybe I'm just too tired but for the life of me I am unable to figure out how to split a string into many smaller strings. Could be because I'm just learning too and still can't figure out how awk can help me, if it can that is.

Here is the problem:
Within a BASH script I need to break down a long string into more manageable sizes. I have a string that is say 200000 characters long and in the format of: "path" "path" "path" "path".

So I need to split this up into paths with no more than 10000 characters per string and preserve the full paths including the quotes. So I was going to initially start at 9000 characters and then scan the characters from there until I find a quite and space combination, or the end of the file occurs, copy all that to a new string variable, and loop until it was done.

Thanks for any help here.
 
This might be useful.

Code:
#!/usr/bin/env sh

s='abc123 def456 ghi789'
for i in $s; do j=`echo $i | cut -c 1-3`; echo $j; done
 
Back
Top