Using SED to compare two csv files and update accordingly
Hi All, I am nearly a complete newbie to Linux and I would like to ask your help to point me in the right direction if possible
I am currently building a prestashop ecommerce site
I need some advice on how to approach what I need to do regularly with two spreadsheet(CSV) files, one being the one from my supplier and the other being my master file used to build the product import CSV file for the prestashop server
The wholesaler regularly updates their product spreadsheet with new products and changes in pricing for existed products. Additionally the availability of products may change.
I need to find a way to compare both spreadsheets using the wholesaler’s SKU and
1. If SKU exists in both spreadsheets then the info on price and availability from the wholesaler’s spreadsheet should overwrite the values on my master spreadsheet
2. If SKU only exists on wholesaler spreadsheet, then my spreadsheet needs to have that SKU inserted exactly in the same position it has in the wholesaler’s spreadsheet, i.e. after the "same" previous SKU.
There are two other SED type scripts I need advice on too
How to append the text for one field (A) to the beginning of another (B), and to then append the text from a different field (C) to the end of (B)
How to fill in a column, with the titles from many other columns and the values
e.g. Feature; Height;1~Colour;4~ e.t.c
The product feature’s import needs everything to be in one cell.
I came up with the following
cat -E JoeTest.csv | sed ':a;N;$!ba;s/\n/<div><div\/> /g'
just to remove the white space in my product description field and add paragraphs. This took me so much time that I decided I would ask for help with the above. Hoping someone here can help or at least point me to some resources that makes the learning process a lot less painfull.
|