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.
4 exec 2>/home/teabear/zmyworkspace/script1.log
5 set -x
9 kdialog -passivepopup "started" 4
15 sort -m -o /home/teabear/bashwork/mfilelist/mfile $elist $plist $folist
16 cp /home/teabear/bashwork/mfilelist/mfile /home/teabear/bashwork/troubleshooting/parsingfiles/mfile_$i
17 for i in `ls /home/teabear/bashwork/dragto`; do
18 grep -awio -f /home/teabear/bashwork/mfilelist/mfile /home/teabear/bashwork/dragto/$i | cat > /home/teabear/bashwork/extractedlist
20 phit=`grep -ioc -f /home/teabear/bashwork/indvlist/puterlist /home/teabear/bashwork/extractedlist`
21 ehit=`grep -ioc -f /home/teabear/bashwork/indvlist/electriclist /home/teabear/bashwork/extractedlist`
22 fohit=`grep -ioc -f /home/teabear/bashwork/indvlist/foodlist /home/teabear/bashwork/extractedlist`
30 if [ "$ehit" -gt "$fohit" ] && [ "$ehit" -gt "$phit" ]
31 then kdialog -passivepopup "$i file will be moved to Electrical folder" 2
32 cp /home/teabear/bashwork/extractedlist /home/teabear/bashwork/troubleshooting/parsingfiles/extractedlist_$i
33 mv $acon $efold
36 elif [ "$fohit" -gt "$ehit" ] && [ "$fohit" -gt "$phit" ]
37 then kdialog -passivepopup "$i file will be moved to Culinary folder" 2
38 cp /home/teabear/bashwork/extractedlist /home/teabear/bashwork/troubleshooting/parsingfiles/extractedlist_$i
39 mv $acon $fofold
42 elif [ "$phit" -gt "$fohit" ] && [ "$phit" -gt "$ehit" ]
43 then kdialog -passivepopup "$i file will be moved to Puter folder" 2
44 cp /home/teabear/bashwork/extractedlist /home/teabear/bashwork/troubleshooting/parsingfiles/extractedlist_$i
45 mv $acon $pfold
51 kdialog -msgbox "end"