6 # - hxpipe (packaged in html-xml-utils on Debian and Ubuntu)
13 DEFAULT_LOCATION
='Boston:'
16 printf "Usage: %s [LOCATION]\n" "$0"
19 printf '%s\n' "$VALID_LOCATIONS"
20 printf "Default LOCATION:\n %s\n" "$DEFAULT_LOCATION"
26 '' ) location
="$DEFAULT_LOCATION";;
30 curl
'https://www.boston.gov/news/coronavirus-disease-covid-19-boston' \
38 /^A/ && $2 == "CDATA" {
39 update_node_attributes()
44 XmlPayload = substr($0, 2, length($0))
47 XmlPath == "/html/body/div/div/input/header/div/div/div/section/article/div/div/div/div/div/div/div/div/address" \
48 && XmlPayload ~ /^[A-Z][a-z]+: +[0-9]+/ {
52 function path_to_string(path, depth, p, i) {
54 for (i = 1; i <= depth; i++) {
60 function update_node( paren, name, key, val, path, attr) {
61 paren = substr($1, 1, 1)
62 name = substr($1, 2, length($1) - 1)
66 XmlPath = path_to_string(_path, _depth)
67 for (key in _hxpipe_curr_attrs) {
68 val = _hxpipe_curr_attrs[key]
69 XmlAttr[XmlPath, key] = val
71 } else if (paren == ")") {
72 delete _hxpipe_curr_attrs
74 for (key in XmlAttr) {
78 if (path == XmlPath) delete XmlAttr[key]
81 XmlPath = path_to_string(_path, _depth)
83 printf("ERROR in input line %d - not a parenthesis: \"%s\"\n", NR, paren) > "/dev/stderr"
88 function update_node_attributes( key, val, s) {
89 key = substr($1, 2, length($1))
92 sub("^" $1 s $2 s, "", val)
93 _hxpipe_curr_attrs[key] = val
96 |
awk -v location
="$location" '
98 weird_space_character = " ";
99 n = split($2, cases, weird_space_character);
This page took 0.086363 seconds and 4 git commands to generate.