Page 1 of 1

Bash: Script to make indexes from csv & md files

Posted: Thu Dec 02, 2021 10:59 am
by puppy_apprentice

I've made some scripts that make indexes from csv files:
viewtopic.php?p=41407#p41407
Added another one for md files:

Code: Select all

#!/bin/sh
#by puppy_apprentice
IFS=','
echo -e "# Java Apps Index\n"
echo "_Last update: $(date)_"
while read -r line || [ -n "$line" ]
do
	array=($line)
	category=${array[0]}
	name=${array[1]}
	link=${array[2]}
	if [[ $categories != *"$category"* ]]; then
	categories+="$category,"
	fi
	declare md_body_$category+="* [$name]($link)\n"
	
done < $1
for cat in $categories
do
temp=md_body_$cat
echo -e "### $cat\n${!temp}"
done