fixed generate script
This commit is contained in:
parent
7150f1d9e0
commit
f077bd40b5
24
generate.sh
24
generate.sh
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user