#!/usr/bin/env bash # replaces " with \" echoescaped(){ echo -n '"' echo "$@" | sed 's/"/\\"/g' echo -n '"' } printRow(){ local id="$1" local title="$(echo "$container" | hq "#$id" text)" local -a headings local -a bodys while IFS= read -rd '' heading; do headings+=("$heading") done < <( echo "$container" | hq "#${id}-container" data |\ hq -0 '.details-header' text ) while IFS= read -rd '' body; do bodys+=("$body") done < <( echo "$container" | hq "#${id}-container" data |\ hq -0 '.details-header + div' text ) # For some reason the html output doesn't put the observed bit in a div like # the others local observed="$(echo "$container" | hq "#${id}-container" data |\ sed -n '/