fixed generate script

This commit is contained in:
Niklas Kapelle 2024-05-31 14:21:51 +02:00
parent 7150f1d9e0
commit f077bd40b5
Signed by: niklas
GPG Key ID: 4EB651B36D841D16

View File

@ -20,12 +20,18 @@ if [ ! -f "$IMAGE_FILE" ]; then
exit 1 exit 1
fi fi
# awk -F, 'NR==FNR {map[$1] = $2; next} {for (key in map) gsub("\\b" key "\\b", map[key]); print}' $MAPPING_FILE $IMAGE_FILE awk -F, '
NR==FNR {
map[$1] = $2
awk -F, 'NR==FNR {map[$1] = $2; next} END {for (key in map) print key, "=>", map[key]}' $MAPPING_FILE next
}
{
# while IFS=, read -r col1 col2 _; do line = $0
# echo "$col1, $col2" for (key in map) {
# done < "$MAPPING_FILE`" # Escape special characters in the key
gsub_key = key
gsub_key = gensub(/[$.*+?^{}|()[\]\\]/, "\\\\\\0", "g", gsub_key)
gsub(gsub_key, map[key], line)
}
print line
}' $MAPPING_FILE $IMAGE_FILE