qty,model,size,color,sku
224,128,MD,B,840197082997
0,128,LG,B,840197083000
0,128,XL,B,840197083017
####
v_products_model,v_attribute_options_id_1,v_attribute_options_name_1_1,v_attribute_values_id_1_1,v_attribute_values_price_1_1,v_attribute_values_name_1_1_1,v_attribute_options_id_2,v_attribute_options_name_2_1,v_attribute_values_id_2_1,v_attribute_values_price_2_1,v_attribute_values_name_2_1_1,v_attribute_values_id_2_2,v_attribute_values_price_2_2,v_attribute_values_name_2_2_1,v_attribute_values_id_2_3,v_attribute_values_price_2_3,v_attribute_values_name_2_3_1,v_attribute_values_id_2_4,v_attribute_values_price_2_4,v_attribute_values_name_2_4_1
128,1,Download,0,,TEXT,2,Size,2,,SM,3,0,MD,4,0,LG,5,0,XL
##
##
#!/usr/bin/perl
open(I1,"IM.csv") or die "IM.csv: $!";
$_ = ; # read column headings
while () { # get data
chomp;
push @lines, $_ ;
}
open(I2,"Attributes-EP2005Sep23-1907.txt") or die "Attributes-EP2005Sep23-1907.txt: $!";
$_ = ; # read column headings
while () { # get data
chomp;
push @lines2, $_ ;
}
foreach ( @lines ) {
my ($qty,$name,$size,$color,$descript) = split /,/;
#print "$qty,$name,$size,$color,$descript\n";
if ($qty <= 0){$qty= ''}
else{$qty=0};
foreach ( shift(@lines2) ) {
my ($v_products_model,$therest) = split(/,/,$_,2);
print "$v_products_model\n";
if ($v_products_model eq $name){
my ($begin, $end) = split(/.,$size/,$therest);
print "$v_products_model,$begin\n";
}
else{push @lines2,$_}
}