You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
2.5 KiB
131 lines
2.5 KiB
#! /bin/bash
|
|
|
|
INPUT_FILE=lists/ifx_price_csv.csv
|
|
|
|
CSV_LINES=()
|
|
LINE_CNT=0
|
|
COL_CNT=0
|
|
DELIMITER=','
|
|
|
|
prducts_arr=(
|
|
"manufacturer"
|
|
"product_no"
|
|
"core_product"
|
|
"ordering_code"
|
|
"description"
|
|
"status"
|
|
"buy_cost"
|
|
"pricing_scheme"
|
|
"price_change_flag"
|
|
"currency"
|
|
"lead_time_days"
|
|
"physical_form"
|
|
"packing"
|
|
"packing_size"
|
|
"minimum_order_quantity"
|
|
"minimum_awarding_quantity"
|
|
"minimum_quote_quantity"
|
|
"proposed_margin"
|
|
"container"
|
|
"container_size"
|
|
"product_class"
|
|
"product_category"
|
|
"product_family"
|
|
"product_group"
|
|
"last_update_date"
|
|
"last_time_buy_date"
|
|
"obsolete_date"
|
|
"pollution_level"
|
|
"production_site"
|
|
"comment_manufacturer"
|
|
"comment")
|
|
|
|
manufacturer="Infineon"
|
|
product_no=2
|
|
core_product=6
|
|
ordering_code=1
|
|
description=10
|
|
status=22
|
|
buy_cost=33
|
|
pricing_scheme=20
|
|
price_change_flag=0
|
|
lead_time_days=8
|
|
physical_form=25
|
|
packing=26
|
|
packing_size=27
|
|
minimum_order_quantity=29
|
|
minimum_awarding_quantity=31
|
|
minimum_quote_quantity=30
|
|
proposed_margin=25
|
|
container="none"
|
|
container_size=29
|
|
product_class=0
|
|
product_category=0
|
|
product_family=0
|
|
product_group=0
|
|
last_update_date="2022-08-14"
|
|
last_time_buy_date=""
|
|
obsolete_date=""
|
|
pollution_level=""
|
|
production_site="DE"
|
|
comment_manufacturer=44
|
|
comment="Test Upload"
|
|
|
|
while IFS= read -r line
|
|
do
|
|
CSV_LINES+=("$line")
|
|
((LINE_CNT++))
|
|
done < $INPUT_FILE
|
|
|
|
IFS=$DELIMITER read -ra HEADER <<< "${CSV_LINES[0]}"
|
|
|
|
|
|
for i in "${HEADER[@]}"; do # access each element of array
|
|
((COL_CNT++))
|
|
done
|
|
|
|
echo "Total line Count = $LINE_CNT"
|
|
echo "Total col Count = $COL_CNT"
|
|
|
|
counter=0
|
|
|
|
for i in "${CSV_LINES[@]}";do
|
|
IFS=$DELIMITER read -ra LINE <<< "${CSV_LINES[$counter]}"
|
|
|
|
if [ $counter -gt 1 ]
|
|
then
|
|
echo "$manufacturer,\
|
|
${LINE[$product_no]},\
|
|
${LINE[$core_product]},\
|
|
${LINE[$ordering_code]},\
|
|
${LINE[$description]},\
|
|
${LINE[$status]},\
|
|
${LINE[$buy_cost]},\
|
|
${LINE[$pricing_scheme]},\
|
|
${LINE[$price_change_flag]},\
|
|
${LINE[$lead_time_days]},\
|
|
${LINE[$physical_form]},\
|
|
${LINE[$packing]},\
|
|
${LINE[$packing_size]},\
|
|
${LINE[$minimum_order_quantity]},\
|
|
${LINE[$minimum_awarding_quantity]},\
|
|
${LINE[$minimum_quote_quantity]},\
|
|
$proposed_margin,\
|
|
$container,\
|
|
${LINE[$container_size]},\
|
|
$product_class,\
|
|
$product_category,\
|
|
$product_family,\
|
|
$product_group,\
|
|
$last_update_date,\
|
|
$last_time_buy_date,\
|
|
$obsolete_date,\
|
|
$pollution_level,\
|
|
$production_site,\
|
|
${LINE[$comment_manufacturer]},\
|
|
$comment"
|
|
fi
|
|
|
|
((counter++))
|
|
done
|