Best way to divide in bash using pipes?

后端 未结 4 1617

I\'m just looking for an easy way to divide a number (or provide other math functions). Let\'s say I have the following command:

find . -name \'*.mp4\' | wc -l
<         


        
4条回答
  •  爱一瞬间的悲伤
    2021-02-02 14:32

    find . -name '*.mp4' | wc -l | xargs -I{} expr {} / 2

    Best used if you have multiple outputs you'd like to pipe through xargs. Use{} as a placeholder for the expression term.

提交回复
热议问题