I'm trying to generate a html file from a text file called index.db. Contents of index.db:
file="test.html"
date="2013-01-07"
title="Example title"
file="test2.html"
date="2014-02-04"
title="Second example title"
The command I'm trying:
sed '/^$/d;H;1h;$!d;g;s/\n\t\+/ /g' input/index.db |
while read -r line; do
awk '{
print "<h1>"title"</h1>"
print "<b>"date"</b>"
print "<a href=\""file"\">"file"</a>"
}' $line
done
And it returns:
awk: fatal: cannot open file `title"' for reading: No such file or directory
awk: fatal: cannot open file `example' for reading: No such file or directory
But if I try the following command, it runs perfectly:
sed '/^$/d;H;1h;$!d;g;s/\n\t\+/ /g' input/index.db |
while read -r line; do
echo $line
awk '{
print "<h1>"title"</h1>"
print "<b>"date"</b>"
print "<a href=\""file"\">"file"</a>"
}' file="test.html" date="2013-01-07" title="Example title"
done