Hello,
Of course providing a simple recipe for that, that'll work in every case is quite impossible. I also don't know enough about your specific application to be able to say what I would really do in your case. Nevertheless I'll try to explain what my general approach to such problems would be.
- Find out what/where the similarities of the scripts are
- Way 1
- Put all the common code (performing database queries, commandline parsing) into a module which implements a class
- Write other classes that inherit from the above base class and implement the specific behaviour of the current scripts in them
- Now you have classes that implement all work and that inherit all common stuff from the base class. No you only need to write some small scripts that simply make an instance of one of the child classes and actually call the code that does the work.
- Way 2
- Parameterize all problems in a way that one piece of code can theoretically perform all the work the different scripts, when it recieves the according parameters
- Write replacements for the current scripts that are just a thin wrapper about the parameterized code above
That would be two ways to solve that problem that just came to my mind. There may be a lot of other ways, that also may be better in your specific case. I just can't know..
Cheers, Flo