32 lines
640 B
Bash
32 lines
640 B
Bash
|
#/usr/bin/env sh
|
||
|
|
||
|
set -eo pipefail
|
||
|
|
||
|
if [ "$#" -ne 2 ]; then
|
||
|
echo "Usage: $0 <mapping.csv> <image.svg>"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
MAPPING_FILE=$1
|
||
|
IMAGE_FILE=$2
|
||
|
|
||
|
if [ ! -f "$MAPPING_FILE" ]; then
|
||
|
echo "$MAPPING_FILE not found!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ! -f "$IMAGE_FILE" ]; then
|
||
|
echo "$IMAGE_FILE not found!"
|
||
|
exit 1
|
||
|
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; next} END {for (key in map) print key, "=>", map[key]}' $MAPPING_FILE
|
||
|
|
||
|
|
||
|
# while IFS=, read -r col1 col2 _; do
|
||
|
# echo "$col1, $col2"
|
||
|
# done < "$MAPPING_FILE`"
|