nanochan1,
these forums are not your paid-for support organization or 1-800-HELPME.
We do the best we can to providing assistance to the folks, but we're a bunch of volunteers with no contractual obligations.
Please be patient and someone will assist you.
To the point... rather than providing your code (which is good) I'd try verbalize what you're after and provide a more representative data samples: before and after. Looking at your samples I don't see the transformation logic.
i don't quite understand the assistance vgersh99 provided me.
the code given what is it for ?
---------- Post updated at 08:01 PM ---------- Previous update was at 07:59 PM ----------
lets say i read in a file...
it shows the available spaces remaining from a file
eg.
if the remaining spaces are less or equal to 9 the compiler will run & allocate without any issues (as above), but if i set remaining spaces to be more than 10 spaces out of the 20 spaces
eg.
my compiler will simply hang and not do anything.
what i need to do is... eg i tell the compiler i need 4 spaces to be allocated to the remaining gaps - automatically.
the compliler will then start checking through and slot whichever gaps it could find with B and my result should return like this for instance:
and if i need 8 spaces to be filled it will be
and if 13 spaces needed to be filled
the codes which i tried to do as show on post #1 only could work for spaces not more than 9 remaining.
If you look close enough both of the solutions take input a file named 'file' in case of danmero's hint or 'myFile' in my case.
Just run the solution(s) with whatever input file name you have.
Am I answer your question or misreading it?
The data you've shown below doesn't remotely resemble what you showed earlier.
What is the actual input you have and what is the actual output you want and what do they have to do with each other? And what shell are you using? :wall:
I don't think you're going to get what you want with sed. You need a language with proper arrays, like awk.
You never did answer my question about what shell you have. What system you have would be good, too. What you want may not be available in all systems.