#!/bin/bash usage() { echo "Usage: $0 "'-d "your_input_data_delimiter_character" -t "My Title" -h "My Header"' 1>&2; exit 1; } IFS_CHAR=$' \t\n' 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' | while IFS=$IFS_CHAR read -ra line ; do echo '' for i in "${line[@]}"; do # for hyperlinking a URL, first un-hash the for statement down below ( i.e. remove the starting # character ), save the file and run it as usual, to find out # the column index number of the URL, then hash it as before and modify the # index number in the if statement further down below ( currently :24 ) and # un-hash all the statements below it, including the if statement, save the file and run it as usual, to make it to work # for index in "${!line[@]}"; do printf "%s:%s\n" "$index" "${line[$index]}"; done if [ -n "$i" ]; then # if [[ ${line[@]:24:1} == "$i" && "$i" =~ ^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$ ]]; then # if [[ ! ( "$i" =~ ^http.*:// || "$i" =~ ^ftp.*:// ) ]]; then # i='http://'$i # fi # echo '' # else echo '' # fi fi done echo '' done echo '
TitleDescriptionVersionAuthorOriginal-siteLicenseSizeExtension_byTags
'Home Page''$( echo $i|sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' )'
' echo echo '' echo '' # Un-hash the below line, if you need a compressed gzip file also, for very large files. # gzip -9 --verbose < $html > $html.gz