# Problem
This assignment allows you to program in a language introduced in lecture: Awk. It was developed by, and named after, Al Aho, Peter Weinberger, and Brian Kernighan, from Bell Labs, in 1977. The GNU distribution of Awk is called Gawk, which has, since 1994, been actively maintained by Arnold Robbins.
Suppose you work for a realtor (my condolences) and your employer wants to put Ada County building-permit information on the company web page. The following filename extensions are relevant:
* `.xlsx` - Microsoft Excel Spreadsheet.
* `.html` - HyperText Markup Language.
* `.csv` - Comma-Separated Values.
The building-permit data is public, but, of course, only as a `.xlsx` file. You want to process the data, eventually producing a `.html` file. You decide to use the LibreOffice program `unoconv` to batch-convert the `.xlsx` file to a `.csv` file, and then process it with an Awk script to produce the `.html` file. Ada County provides the `.xlsx` file, from:
https://adacounty.id.gov/Development-Services/Building-Division/
I provide the corresponding `.csv` file, at: `pub/la5`
You need to write the Awk script to produce a simple `.html` file (see below). You can view your result with a web browser (e.g., Firefox).
# Process
```awk
#!/usr/bin/env gawk
BEGIN {
titleString = "Building Permits"
fieldsString = "Issue Date|Building Permit Number|Description|Square Footage|Subdivision Name|Lot|Block|Value"
# Create a row to hold the field names.
split(fieldsString, fieldsArray, "|")
fieldsRowString = "<tr>"
for (i in fieldsArray) {
fieldsRowString = fieldsRowString "<td>" fieldsArray[i] "</td>"
}
fieldsRowString = fieldsRowString "</tr>"
print "<html>" \
"<head>" \
"<title>" titleString "</title>" \
"</head>" \
"<body>" \
"<h1>" titleString "</h1>" \
"<table>" \
fieldsRowString
}
{
# Create a row element for every line in the input file.
dataRowString = "<tr>"
for (i = 1; i <= NF; i++) {
dataRowString = dataRowString "<td>" $i "</td>"
}
dataRowString = dataRowString "</tr>"
print dataRowString
}
END {
# Print the final closing tags of the HTML document.
print "</table>" \
"</body>" \
"</html>"
}
```
```bash
$ gawk --csv -f script.awk BldgPrmtsPublic10-01-2017To10-15-2017.csv > output.html
```
# Answer
...