Interesting line but i am not sure how it would work. The value 0 and negative cannot happen since they are filtered out already. The other thing is that the values arent in order and the full list of numbers is alot bigger.
Below is the current version which works with the help from Scrutinizer. The $14 value is the original position of the value so i did not change that in this one.
As you see it are alot of values to list and the last several lines even gave me errors which i cannot seem to find (Not really important as 750 is the highest number). If there is a way to shorten this that would be really nice.
Wow, both are awesome. I will test them all 3 and see which is easiest to work with for me. The last one looks very nice but we have to be carefull that there are a exact same number on each line so that makes it dangerous also when editing.
Again i will check them out and update this thread.
I will test them out as soon as i can but i did not get the time for it today. Maybe tonight i will have a couple min to test them. I will get back to this and update the thread asap.
That would be even easier and i see how i accidently messed up the code so it only worked with the example. With a seperate file it would be even easier as it only needs editing without touching the code.
The only thing i need to change is the seperator itself as everything we use has ; in it but that is a easy fix. Instead of the OFS i will use the FS = OFS = ";" line in the beginning. At the end i will use $1 and $2 so i can call this script from the other one.
Thank you for the even better version of the script.
A couple min ago i tested the script from you RudiC and it worked superb. My co-workers found it even easier to edit because everything was in a seperate file. Below is the full script as we use it now.
awk '
BEGIN {FS = OFS = ";"
print "Reference;EAN;Condition;Stock;Price;Deliverycode;;manufacturer;Titel;MPN;supplier_code;Sup Category;Bol Category;Cost;Marge;Dropship Cost;Bol Vast Comm;Bol Vari Comm;;;;Marge Berekend;CMD;CMD + Bol Comm"
}
FNR == NR {CV[NR] = $1
SV[NR] = $2
MX = NR
next
}
{for (i=1; $14<CV && i<MX; i++);
print $0, SV
}
' OFS=";" /srv/prijslijst/filters/marges.csv $1 > $2