I have this command that I would like to sum all the numbers from the output.
The command looks like this
$(hadoop fs -ls -R /reports/dt=2018-08-27 | grep _stats.json | awk '{print $NF}' | xargs hadoop fs -cat | jq '.duration')
So it's going to list all the folders in /reports/dt=2018-08-27
and get only _stats.json
and pass that through jq
from hadoop -cat
and get only .duration
from the json. Which in the end I get the result like this.
1211789 1211789 373585 495379 1211789
But I would like the command to sum all those numbers together to become 4504331