Last active
July 1, 2022 01:57
-
-
Save gardart/e4b3e51f58a1ce94b2f7 to your computer and use it in GitHub Desktop.
Create multiple html files from csv file using a template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create multiple html files from csv file using a template | |
# CSV file has the structure: | |
# filename href | |
# | |
INPUT=data.csv | |
OLDIFS=$IFS | |
IFS=, | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read flname href | |
do | |
sed -e "s@FLNAME@${flname}@" \ | |
-e "s@HREF@${href}@" \ | |
template.txt > $flname.html | |
done < $INPUT | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment