author | František Kučera <franta-hg@frantovo.cz> |
Sat, 26 Oct 2019 20:57:42 +0200 | |
branch | v_0 |
changeset 276 | cfaf1fa94154 |
parent 268 | 1b8576c9640c |
permissions | -rwxr-xr-x |
268
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
#!/bin/bash |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
|
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
URL="https://relational-pipes.globalcode.info/v_0/implementation.xhtml"; |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
|
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
# or we can use wget, if curl is missing or we like wget more: |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
# curl() { wget -O - "$1"; } |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
|
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
curl "$URL" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
| relpipe-in-xmltable \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
--namespace "h" "http://www.w3.org/1999/xhtml" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
--relation "implementation" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
--records "//h:table[1]/h:tbody/h:tr" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
--attribute "name" string "h:td[1]" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
--attribute "type" string "h:td[2]" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
--attribute "subtype" string "h:td[3]" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
| relpipe-tr-sql \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
--relation \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
"relpipe_commands" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
"SELECT |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
subtype AS type, |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
count(*) AS count |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
FROM implementation |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
WHERE type = 'executable' |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
GROUP BY type, subtype |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
ORDER BY count DESC" \ |
1b8576c9640c
examples: XHTML table processing in SQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
| relpipe-out-tabular |