# Line 1 extracts the published date from the HTML file
# Line 2 re-arranges this information, and converts it into DD MM YY format
# Line 3 converts this into a UNIX timestamp
date_mod+=$'\n'
done
date_mod=$(echo"$date_mod"| head -n -1)# Remove last (empty) line from variable
echo"$date_mod" > $BASE_PATH/temp/date_mod.txt # Write the corresponding 'date modified' timestamps to a temp file
paste $BASE_PATH/temp/file_listing.txt $BASE_PATH/temp/date_mod.txt > $BASE_PATH/temp/new_file_list.txt # Combine file list and date modified into a single file
sorted_file_list=$(sort -k 2$BASE_PATH/temp/new_file_list.txt)# Sort the data in the file, and store it into a variable
sorted_file_list=$(echo"$sorted_file_list"| awk '{print $1}')# Store only the first column (the file path) in the variable
}
gen_index_page(){# Generate an index page (site map) that includes links to the other pages
for file in $1;do
title=$(cat $file| grep "<title>"| head -n 1| awk -F'[<>]''{print $3}')# Find the title of the web page
title=$(cat $file| grep "<title>"| head -n 1| awk -F'[<>]''{print $3}')# Find the title of the web page
suffix=" - Two More Cents"
suffix=" - Two More Cents"
title=${title%"$suffix"}# Remove the website name from it
title=${title%"$suffix"}# Remove the website name from it
@ -119,13 +144,18 @@ gen_index_page() { # Generate an index page (site map) that includes links to th
pub_date=$(cat $file| grep "date-published"| head -n 1| awk -F'[<>]''{print $3}')# Find the date published
pub_date=$(cat $file| grep "date-published"| head -n 1| awk -F'[<>]''{print $3}')# Find the date published
prefix="Published on "# Find date published of webpage
prefix="Published on "# Find date published of webpage
pub_date=${pub_date#"$prefix"}# Remove the prefix from it
pub_date=${pub_date#"$prefix"}# Remove the prefix from it
pub_date=${awk"{print $1$3}""$pub_date"}# Extract the month and year
pub_date=$(echo"$pub_date"| tr -d ","| awk '{print $2" "$1" "$3}'| date -f - +"%m/%d/%Y")# Re-arrange the date and convert to mm/dd/yy