magento
asked on
perl or Simple Excel macro
Hi,
Need help on a data migration.
Reversal of this question.
https://www.experts-exchange.com/questions/28330561/Need-perl-help.html
Input:
ID Product Details
2500 PROD894,PROD888,PROD900,PR OD23,PROD1 7
2501 PROD390
2502 PROD388
2503 PROD440,PROD433,PROD475
Output:
ID Product Details
2500 PROD894
2500 PROD888
2500 PROD900
2500 PROD23
2500 PROD17
2501 PROD390
2502 PROD388
2503 PROD440
2503 PROD443
2503 PROD475
Thanks
Need help on a data migration.
Reversal of this question.
https://www.experts-exchange.com/questions/28330561/Need-perl-help.html
Input:
ID Product Details
2500 PROD894,PROD888,PROD900,PR
2501 PROD390
2502 PROD388
2503 PROD440,PROD433,PROD475
Output:
ID Product Details
2500 PROD894
2500 PROD888
2500 PROD900
2500 PROD23
2500 PROD17
2501 PROD390
2502 PROD388
2503 PROD440
2503 PROD443
2503 PROD475
Thanks
perl -lane 'BEGIN{local $\;print"".<>}print "$F[0]\t$_" for split/,/,$F[1]' < Input > Output
ASKER
Ozo,
Getting the below error. Pls advice
Getting the below error. Pls advice
C:\Expert-Exchange\perl>perl -lane 'BEGIN{local $\;print"".<>}print "$F[0]\t$_"
for split/,/,$F[1]' < perl.csv > order.csv
> was unexpected at this time.
DOS shell would use different quotes
perl -lane "BEGIN{local $\;print''.<>}print qq'$F[0]\t$_' for split/,/,$F[1]" < Input > Output
perl -lane "BEGIN{local $\;print''.<>}print qq'$F[0]\t$_' for split/,/,$F[1]" < Input > Output
Your example looked like
ID Product Details
2500 PROD894,PROD888,PROD900,PR OD23,PROD1 7
2501 PROD390
2502 PROD388
2503 PROD440,PROD433,PROD475
But your perl.csv looks like
1,"0,0,0,0,0"
2,20
3,20
4,"23,23,27"
What should the output be for the latter?
ID Product Details
2500 PROD894,PROD888,PROD900,PR
2501 PROD390
2502 PROD388
2503 PROD440,PROD433,PROD475
But your perl.csv looks like
1,"0,0,0,0,0"
2,20
3,20
4,"23,23,27"
What should the output be for the latter?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.