I am in the process of updating a folder of hundreds of recipe html files. I've already managed to modify a number of things in each file but I have run into something that's beyond my ability.
I have a text file that I need to insert the contents into the html at a specific point. It creates several link buttons near the top of all the html pages. With the help of several people in this forum, I have a function that does this. I've even modified it for other modifications I have made to the html files and it works well. I've run into a roadblock though. The html recipe files are for a number of food categories and what html I insert for the function I am working on now is dependent upon what category the recipe is in. Unfortunately all these files are in one folder and are not named in a way that they can be sorted into categories. The only way to determine the category is to parse the html of each file.
Here is the function that loops through all the html files and inserts the text file contents in the correct position in each:
However, as I have said, the text to insert is dependent on the recipe category. I have text files for each category.
The only way to determine the category of each file is to parse the html. Here are examples from several different categories. The overall format is the same for all 800 files.
Once I determine what the category of the current file being processed is I am going to have to call a modified version of the function I have in the first code box that inserts the correct text.
Cakes and Cheesecakes = cakesandcheesecakes.txt
Cookies = cookies.txt
Main Dishes = maindishes.txt
etc., etc.,etc.
(There are 17 categories overall)
I am perplexed regarding how I can loop through each html file, determine the category and insert the appropriate text according to the category.
Any guidance regarding how I need to approach this?
Hi All,
I'm trying to write while loop with multiple if conditions. Each and every if condition with different variables. whenever one if condition fails i have remove the file
from filename and have to pick another file and loop should exit until the last file found in filename. Please help... (4 Replies)
Hi,
I want to read file multiple times. Right now i am using while loop but that is not working.
ex.
While read line
do
while read line2
do
echo stmt1
#processing some data based on data.,
done < file2.txt
done < file1.txt # This will have 10... (4 Replies)
Hey all,
I'm trying to do some very basic scripting. I been scouring the board looking at examples but I just can't seem to piece something together.
Edit: Now that I look at it, maybe my request is a little more complex and I'm biting off more than I can chew...
1. Take a list of... (3 Replies)
I am trying to use a loop to start tasks 0-3, running 0,1,2 in the background with &.
FOLDSET=( 0 1 2 3 )
for FOLDSET in ${FOLDSET}
do
if ; then
BACKGRD="&"
else
BACKGRD=""
fi
# start task $FOLDSET
task1 -nogui -ni -p $PROJ \
epochs=$EPOS ... (3 Replies)
Scenario:
I have two PCs (named as A & B) which would send some traps to my third PC (named as C).
In PC C, I have to write a shell script such that it should accept the datas from both the PC-A & B parallely.
So my question is, is it possible to have two different child threads/tasks... (2 Replies)
Hi
I have these data
0.9>i>0.1
0.45>j>0.01
I want to execute the script file for different number of i and j using the command
$ ./scriptfile i j
I write this code
#bin/bash
for ((i>0.1; i<0.9; i++))
for ((j>0.01; j<0.45; j++))
do
./scriptfile $i $j
done
However, for loop is not... (3 Replies)
I thought I was getting pretty good with Bash but this problem is stumping me. Any suggestions would be greatly appreciated. I've written a firewall script that uses a lot of functions. The variables are read into the script from another .conf file earlier on in the code. Most of these... (2 Replies)
I have a script which selects two 'sets' of system LVM device files from a tabular file 'mapfile' using awk :
LIVELV=`awk '{print($1)}' mapfile`
BCVLV=`awk '{print($3)}' mapfile`
I wanted to pass these 'sets' into an LVM command 'loop' along the lines of :
lvmerge $BCVLV $LIVELV
ie.... (3 Replies)