multiply digits within a number with each other

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I have list of numbers and I want to multiply the digits within each number with each other.
for example number 1234 is 1X2X3X4=24



I have this list for example



7675342567
098765342567
1234567890
0987654
234567
8765678
98
0999
09876543
345678
876543
87654


the results must be



7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


how can i do it please help i don't know bash at all . i searched a lot on the internet and i could not figure out how to do it please help










share|improve this question









New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 6




    why downvote please help
    – Sydney
    49 mins ago






  • 2




    please see my answer below and upvote from me ;-)
    – Goro
    48 mins ago











  • Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
    – andcoz
    48 mins ago






  • 6




    @andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
    – Sydney
    46 mins ago






  • 1




    Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
    – choroba
    36 mins ago














up vote
4
down vote

favorite












I have list of numbers and I want to multiply the digits within each number with each other.
for example number 1234 is 1X2X3X4=24



I have this list for example



7675342567
098765342567
1234567890
0987654
234567
8765678
98
0999
09876543
345678
876543
87654


the results must be



7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


how can i do it please help i don't know bash at all . i searched a lot on the internet and i could not figure out how to do it please help










share|improve this question









New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 6




    why downvote please help
    – Sydney
    49 mins ago






  • 2




    please see my answer below and upvote from me ;-)
    – Goro
    48 mins ago











  • Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
    – andcoz
    48 mins ago






  • 6




    @andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
    – Sydney
    46 mins ago






  • 1




    Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
    – choroba
    36 mins ago












up vote
4
down vote

favorite









up vote
4
down vote

favorite











I have list of numbers and I want to multiply the digits within each number with each other.
for example number 1234 is 1X2X3X4=24



I have this list for example



7675342567
098765342567
1234567890
0987654
234567
8765678
98
0999
09876543
345678
876543
87654


the results must be



7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


how can i do it please help i don't know bash at all . i searched a lot on the internet and i could not figure out how to do it please help










share|improve this question









New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have list of numbers and I want to multiply the digits within each number with each other.
for example number 1234 is 1X2X3X4=24



I have this list for example



7675342567
098765342567
1234567890
0987654
234567
8765678
98
0999
09876543
345678
876543
87654


the results must be



7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


how can i do it please help i don't know bash at all . i searched a lot on the internet and i could not figure out how to do it please help







bash






share|improve this question









New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 51 mins ago









Goro

7,54253270




7,54253270






New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 51 mins ago









Sydney

312




312




New contributor




Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sydney is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 6




    why downvote please help
    – Sydney
    49 mins ago






  • 2




    please see my answer below and upvote from me ;-)
    – Goro
    48 mins ago











  • Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
    – andcoz
    48 mins ago






  • 6




    @andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
    – Sydney
    46 mins ago






  • 1




    Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
    – choroba
    36 mins ago












  • 6




    why downvote please help
    – Sydney
    49 mins ago






  • 2




    please see my answer below and upvote from me ;-)
    – Goro
    48 mins ago











  • Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
    – andcoz
    48 mins ago






  • 6




    @andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
    – Sydney
    46 mins ago






  • 1




    Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
    – choroba
    36 mins ago







6




6




why downvote please help
– Sydney
49 mins ago




why downvote please help
– Sydney
49 mins ago




2




2




please see my answer below and upvote from me ;-)
– Goro
48 mins ago





please see my answer below and upvote from me ;-)
– Goro
48 mins ago













Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
– andcoz
48 mins ago




Sorry but this is not a scripting service. If you do not know any shell scripting, you'd start learning.
– andcoz
48 mins ago




6




6




@andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
– Sydney
46 mins ago




@andcoz i don't like programming and it is not my hobby, I have problem and I need help what is wrong with that?
– Sydney
46 mins ago




1




1




Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
– choroba
36 mins ago




Sydney: The problem is that this site teaches people programming. If you don't care about the "how", pay someone to solve the problem for you.
– choroba
36 mins ago










1 Answer
1






active

oldest

votes

















up vote
6
down vote



accepted










You can do it this way:



<file sed 's/./&*/g;s/*$//' | bc

7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


With GNU sed, that can be simplified as:



<file sed 's/./*&/2g' | bc





share|improve this answer


















  • 1




    thank you for help!
    – Sydney
    44 mins ago










  • @Stéphane Chazelas. thank you very much ;-)
    – Goro
    38 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Sydney is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474021%2fmultiply-digits-within-a-number-with-each-other%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote



accepted










You can do it this way:



<file sed 's/./&*/g;s/*$//' | bc

7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


With GNU sed, that can be simplified as:



<file sed 's/./*&/2g' | bc





share|improve this answer


















  • 1




    thank you for help!
    – Sydney
    44 mins ago










  • @Stéphane Chazelas. thank you very much ;-)
    – Goro
    38 mins ago














up vote
6
down vote



accepted










You can do it this way:



<file sed 's/./&*/g;s/*$//' | bc

7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


With GNU sed, that can be simplified as:



<file sed 's/./*&/2g' | bc





share|improve this answer


















  • 1




    thank you for help!
    – Sydney
    44 mins ago










  • @Stéphane Chazelas. thank you very much ;-)
    – Goro
    38 mins ago












up vote
6
down vote



accepted







up vote
6
down vote



accepted






You can do it this way:



<file sed 's/./&*/g;s/*$//' | bc

7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


With GNU sed, that can be simplified as:



<file sed 's/./*&/2g' | bc





share|improve this answer














You can do it this way:



<file sed 's/./&*/g;s/*$//' | bc

7408800
0
0
0
5040
564480
72
0
0
20160
20160
6720


With GNU sed, that can be simplified as:



<file sed 's/./*&/2g' | bc






share|improve this answer














share|improve this answer



share|improve this answer








edited 39 mins ago









Stéphane Chazelas

287k53531868




287k53531868










answered 48 mins ago









Goro

7,54253270




7,54253270







  • 1




    thank you for help!
    – Sydney
    44 mins ago










  • @Stéphane Chazelas. thank you very much ;-)
    – Goro
    38 mins ago












  • 1




    thank you for help!
    – Sydney
    44 mins ago










  • @Stéphane Chazelas. thank you very much ;-)
    – Goro
    38 mins ago







1




1




thank you for help!
– Sydney
44 mins ago




thank you for help!
– Sydney
44 mins ago












@Stéphane Chazelas. thank you very much ;-)
– Goro
38 mins ago




@Stéphane Chazelas. thank you very much ;-)
– Goro
38 mins ago










Sydney is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Sydney is a new contributor. Be nice, and check out our Code of Conduct.












Sydney is a new contributor. Be nice, and check out our Code of Conduct.











Sydney is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474021%2fmultiply-digits-within-a-number-with-each-other%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke