relpipe-data/examples/xhtml-table-sql-statistics.sh
branchv_0
changeset 268 1b8576c9640c
equal deleted inserted replaced
267:1826d1cce404 268:1b8576c9640c
       
     1 #!/bin/bash
       
     2 
       
     3 URL="https://relational-pipes.globalcode.info/v_0/implementation.xhtml";
       
     4 
       
     5 # or we can use wget, if curl is missing or we like wget more:
       
     6 # curl() { wget -O - "$1"; }
       
     7 
       
     8 curl "$URL" \
       
     9 	| relpipe-in-xmltable \
       
    10 		--namespace "h" "http://www.w3.org/1999/xhtml" \
       
    11 		--relation "implementation" \
       
    12 			--records "//h:table[1]/h:tbody/h:tr" \
       
    13 			--attribute "name"     string "h:td[1]" \
       
    14 			--attribute "type"     string "h:td[2]" \
       
    15 			--attribute "subtype"  string "h:td[3]" \
       
    16 	| relpipe-tr-sql \
       
    17 		--relation \
       
    18 			"relpipe_commands" \
       
    19 			"SELECT
       
    20 				subtype AS type,
       
    21 				count(*) AS count
       
    22 			FROM implementation
       
    23 			WHERE type = 'executable'
       
    24 			GROUP BY type, subtype
       
    25 			ORDER BY count DESC" \
       
    26 	| relpipe-out-tabular