#!/bin/sh # html header header() { printf '%s' " files " } #html footer footer() { printf '%s' " " } # for every line of input # check if it contains "line" # if it does, output it exclude() { while read -r line do case "$line" in *"path"* ) printf '%s\n' "$line" ;; esac done } # for every line of input # strip "path": " from the start # string ", from the end strip() { while read -r line do nameandtail="${line##\"path\": \"}" name="${nameandtail%%\",}" printf '%s\n' "$name" done } # for every line of input # append root to the start # format path and name as href pad() { while read -r line do path="https://kaa.neocities.org/$line" href=" $line " printf '\t\t%s\n' "$href" printf '\t\t%s\n' "
" done } header exclude | strip | pad footer