Welcome to LQ.
Well you need to decide whether you wish to do this via script, program or both.
If you're running Linux and running one of the popular desktop distributions, then you likely have a compiler for C and C++ programs. Likely you have Python if you choose to try Python scripts. Likely also you have a shell, such as BASH to allow you to write BASH scripts.
You've defined a problem to solve. That's fine. Probably need some refinement on the limitations or input/output boundaries, but otherwise it seems a fine problem to tackle. And one which you can address using the languages or script capabilities I've discussed.
As far as BASH scripting, my signature contains some links, some of others and one of my blog about BASH scripting, and the one about debugging C programs while it's intentions are to illustrate how to debug a problem, also does show rudimentary compiling from the command line.
So I suggest a few things:
- Determine which language you wish to try out, or at least the path you wish to try, for instance 'try BASH first, then C', or 'try Python first, then BASH', etc
- Start writing something to address your defined problem, .... actually starting writing the very most basic script or program to get your feet wet, and then start at your problem
- Post your progress - Please note that at LQ we are happy to help however we like to see that you put in some effort, therefore people are not interested in solving this problem and 'giving' you a solution, but instead people will help you work towards that solution and refine it so that you can learn the things you say you are trying to learn.
Best of luck and looking forward to your updates!