gringomike
Technical User
Hi all,
I've written a korn shell script, part of which populates an array with the contents of a text file.
The text is inserted into the first position of the array in this format (which is how I want it to look when it is written back out);
<position 1>
line1
line2
line3
line4
<positions 2>
line1
line2
line3
line4
line5
The problem I have is that it comes back out in this format;
line1 line2 line3 line4
line1 line2 line3 line4 line5
This section generates the entry in the array;
NEW=`cat $line | sed -e 's/^some_text=//' -e 's/^moretext="//' -e 's/"//' -e '/^$/d' -e 's/^[ \]*//
' -e '1d' -e '$d'`
baseline=$NEW
# Set up arrays with environment name and log path
envir[arrayCount]="$tempEnvir"
app[arrayCount]="$tempApp"
files[((arrayCount))]="$line"
base[arrayCount]="$baseline"
let arrayCount="arrayCount+1"
This section outputs the contents of the array into an HTML file;
for ENV1 in $tempEnvir
do
echo "<td valign="top">${envir[count]}</td>">>$PROPS_LOG
echo "<td valign="top">${app[count]}</td>">>$PROPS_LOG
echo "<td valign="top">${base[count]}</td>">>$PROPS_LOG
echo "<td>">>$PROPS_LOG
done
My initial thought was that I would need to nest another "for" loop inside the section of code that generates the HTML file however everything I've tried so far has been unsuccessful.
Does anybody know of a way to do this?
I hope this makes sense!
Thanks
GM
I've written a korn shell script, part of which populates an array with the contents of a text file.
The text is inserted into the first position of the array in this format (which is how I want it to look when it is written back out);
<position 1>
line1
line2
line3
line4
<positions 2>
line1
line2
line3
line4
line5
The problem I have is that it comes back out in this format;
line1 line2 line3 line4
line1 line2 line3 line4 line5
This section generates the entry in the array;
NEW=`cat $line | sed -e 's/^some_text=//' -e 's/^moretext="//' -e 's/"//' -e '/^$/d' -e 's/^[ \]*//
' -e '1d' -e '$d'`
baseline=$NEW
# Set up arrays with environment name and log path
envir[arrayCount]="$tempEnvir"
app[arrayCount]="$tempApp"
files[((arrayCount))]="$line"
base[arrayCount]="$baseline"
let arrayCount="arrayCount+1"
This section outputs the contents of the array into an HTML file;
for ENV1 in $tempEnvir
do
echo "<td valign="top">${envir[count]}</td>">>$PROPS_LOG
echo "<td valign="top">${app[count]}</td>">>$PROPS_LOG
echo "<td valign="top">${base[count]}</td>">>$PROPS_LOG
echo "<td>">>$PROPS_LOG
done
My initial thought was that I would need to nest another "for" loop inside the section of code that generates the HTML file however everything I've tried so far has been unsuccessful.
Does anybody know of a way to do this?
I hope this makes sense!
Thanks
GM