ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

This is a trimmed and scaled down portion of the script I am working on.

I am trying to figure out how to get it to post properly on my website using kompoZer so anyone could look at the whole of it to help me, if they are willing. But until then.

It is a learning experiance for me and hopefully will be useful for me when its done. I know it needs a huge amount of cleaning (if not just thrown out!).

I started making a simple front end (if I am using the term correctly). Thats when I realized the comparison part of the script (lines 30-48) is not yet easily configurable for me.
I think I will be able, using the basic tools and constructs in a script, to change the number and content of the various lists that are being used and to feed them into the script. But when it comes to the comparison part I don't know how to proceed.

I am guessing that some form of nested loop would be best,(but of course, I have yet to be correct about anthing)

I would like to be able to change the value and the shear number of the different categories that are being parsed for. I may only want to parse for the three categories that are shown here
but I may want to parse for twenty different categories.

Please offer up the good ways to make the comparison part of this configurable. I would like to stick with bash and the basics because that is after all what I am trying to learn at this time.

Please start with just the ideas don't post a finished script. Obviously I haven't been able to figure it out on my own but if you say it will definatly
work using "name an idea" I will bang my head against man and google some more on that specific idea.

Thanks for any help, I am going to ask for general cleanup help with it when I can get it to post proper on my website.

It looks like the comparison part of the script (lines 30-48) is trying to find the maximum hits. You could find the max by sorting and taking the last, or more efficiently by looping over the list once, keeping the largest number so far.

Yes, I had been making copies of the "mfile" along with copies of the "extracted" lists. Then I realized only one copy of the master list (mfile) would be needed as it remains the same for the entire run. I removed it from where it had been(with each elif) and just put it once at the top but got it to far up by accident. I will move it to a better location.