Skip to content

Instantly share code, notes, and snippets.

split -l 10000 premiercustomer.csv
a=1
mv -- premiercustomer.csv ../premiercustomer_bkp.csv
for i in *; do
new=$(printf "premiercustomer%02d.csv" "$a")
mv -- "$i" "$new"
let a=a+1
done
DELIMITER=“,”
for i in $(cut -f 1 -d "${DELIMITER}" file1.csv );
do
if ! [ grep "${i}" file2.csv ]
then
echo “This Email does not exist"
cut -f 1 -d "${DELIMITER}"
fi
done
@Ranjanivraman
Ranjanivraman / join sqls
Last active March 8, 2018 10:09
eav table sql joins
SELECT * from catalog_product_entity_url_key where entity_id = '50608';
SELECT * FROM catalog_product_entity WHERE ENTITY_ID = '50608'
select entity_id, sku , value as name from catalog_product_entity_varchar where entity_id = (select entity_id from catalog_product_entity where sku = 'MGS118237')
and attribute_id = (select attribute_id from `eav_attribute` where entity_type_id = '4' and attribute_code = 'name') and store_id = '0';
SELECT url_rewrite_id, request_path
FROM enterprise_url_rewrite
WHERE request_path REGEXP '-[a-zA-Z0-9]{32}'
AND target_path LIKE 'catalog/category/view/id/%'
@Ranjanivraman
Ranjanivraman / gist:db1033cc0e5b556de6dc64a73fb969b4
Created December 8, 2016 14:47 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@Ranjanivraman
Ranjanivraman / gist:939a5eb524ff15a8a4810a849dfb611f
Created December 13, 2016 09:29
nouveautes nginx rewrites
rewrite ^/nouveautes/retour-en-stock(.*) https://$http_host/new-in/back-in-stock permanent;
rewrite ^/nouveautes/retour-en-stock(.*) https://$http_host/nouveautes-c139cc7b7929293a440abd7a16552b05/retour-en-stock permanent;
rewrite ^/nouveautes/nouveautes-accessoires(.*) https://$http_host/new-in/accessories permanent;
rewrite ^/nouveautes/accessoires(.*) https://$http_host/nouveautes-c139cc7b7929293a440abd7a16552b05/nouveautes-accessoires permanent;
rewrite ^/nouveautes/nouveautes-chaussures(.*) https://$http_host/new-in/footwear permanent;
rewrite ^/nouveautes/chaussures(.*) https://$http_host/nouveautes-c139cc7b7929293a440abd7a16552b05/nouveautes-chaussures permanent;
rewrite ^/nouveautes/nouveautes-vetements(.*) https://$http_host/new-in/clothing permanent;
rewrite ^/nouveautes/vetements(.*) https://$http_host/nouveautes-c139cc7b7929293a440abd7a16552b05/nouveautes-vetements permanent;
?fh_location=//catalog01/en_GB/colour>{brown}&fh_refpath=1d0c4249-d96d-4605-9d19-bc1122a410e3&fh_reffacet=colour&fh_refview=lister
&fh_view_size=50
&fh_sort_by=-price
&fh_secondid=6565656_uk
&mg_channel=website or iphone-app
https://www-test14.mgnonprod.co.uk/dresses/red-mini-dresses
fh_location=//missguideduk/en_GB/categories<{missguideduk_dresses**uk}/categories<{missguideduk_dresses**uk_minidresses**uk}/colour_swatch>{red}
https://www-test14.mgnonprod.co.uk/dresses/mini-dresses#colour_swatch=red;black
select * from enterprise_url_rewrite where target_path like '%%nouveautes-c139cc7b7929293a440abd7a16552b05%%'
select * from enterprise_url_rewrite where request_path like '%%nouveautes-c139cc7b7929293a440abd7a16552b05%%'
select count(*) from enterprise_url_rewrite where target_path like '%nouveautes-c139cc7b7929293a440abd7a16552b05%'
select count(*) from enterprise_url_rewrite where target_path like '%nouveautes-c139cc7b7929293a440abd7a16552b05%'
select count(*) from enterprise_url_rewrite where target_path like '%nouveautes%'
select value from catalog_category_entity_url_key where entity_id = '1399' and store_id = '6';
select value from catalog_category_entity_url_key where entity_id = '1399' and store_id = '6';
update catalog_category_entity_url_key
set value = 'nouveautes'
entity_id = '1399' and store_id = '6' and value = 'nouveautes-c139cc7b7929293a440abd7a16552b05';
select value from catalog_category_entity_url_key where entity_id = '1399' and store_id = '6';
select value from catalog_category_entity_url_key where entity_id = '545' and store_id = '6';