#!/bin/sh usage() { echo "Usage: $0 "'-d "your_input_data_delimiter_character" -t "My Title" -h "My Header"' 1>&2; exit 1; } IFS_CHAR=" " MY_TITLE="MY_TITLE" MY_HEADER="MY_HEADER" while getopts "d:t:h:" inp; do case "${inp}" in d) IFS_CHAR=${OPTARG};; t) MY_TITLE=${OPTARG};; h) MY_HEADER=${OPTARG};; *) usage;; esac done # Compose the html file with the Header, Body ( Data ) and Footer echo '' echo '' echo ' ' echo ''$MY_TITLE'' echo '' echo echo '' echo '' echo '' # changing-colors echo '

'$MY_HEADER'

' echo '' echo '' # the following 10 lines are commented by way of the first and last line characters. Please remove the first and last lines to get fixed-width of columns. Also, adjust the number of col lines and their values, to suit yur input data. << --MULTILINE-COMMENT-- echo '' --MULTILINE-COMMENT-- # the following 13 lines are commented by way of the first and last line characters. Please remove the first and last lines to get customized table header lines. Also, adjust the number of header lines and header data, to suit your input. << --MULTILINE-COMMENT-- echo '' echo '' echo '' echo '' # echo '' echo '' echo '' echo '' echo '' echo '' echo '' --MULTILINE-COMMENT-- # Read the standard input data file contents into an Array, Check for URLs to Create Hyperlinks and # Also Substitute html sensitive characters with proper syntax cat - | sed '/^$/d' | awk -F "$IFS_CHAR" -v header=1 'BEGIN{OFS="\t";} { # gsub(//, "\\>") # gsub(/&/, "\\>") print "\t" for(f = 1; f <=NF; f++) { if(NR == 1 && header) { printf "\t\t\n", $f } else printf "\t\t\n", $f } print "\t" } END { print "
TitleDescriptionVersionAuthorOriginal-siteLicenseSizeExtension_byTags
%s%s
" }' # Un-hash the below line, if you need a compressed gzip file also, for very large files. # gzip -9 --verbose < $html > $html.gz