i need to edit this csv file in batch
id;category;name/code;description;sku;price;weight;options;enable discounts;discounts;availability type;available;pending;images
iqhk8mjh;Software;Quick Heal Antivirus Pro;Quick Heal Antivirus Pro;quickh1;29,90;0;;0;;Dynamic;10;0;C:\Users\Matteo\Dropbox\siti\quick\av2021.png
i tryed with powershell
You can do it with PowerShell but I would recommend Miller (available here for several OSs) instead:
mlr --icsv --ifs ';' --otsv cut -f 'id,price,available' then rename 'available,quantity' then filter '$quantity != 0' then put '$codice = 1234' file.csv
Output:
id price quantity codice
iqhk8mjh 29,90 10 1234
--icsv --ifs ';'
=> set the input format to CSV with ;
as field separator.--otsv
=> set the output format to TSV (TAB separated values).cut -f 'id,price,available'
=> only keep those fields.rename 'available,quantity'
=> rename the field available
to quantity
filter '$quantity != 0'
=> only keep rows for which quantity
isn't 0
put '$codice = 1234'
=> add the field codice
with the value 1234
to each rownote: then
is for chaining operations in Miller