I want to count letters in files. They are on different levels. I used
wc -m `ls -R`
however, it works only for files that are in current directory. I need either to list full paths or extend wc scope.
I tried using
ls -d -1 $PWD/*
as several other answers suggest, but it is not recursive in any way. It prints as many levels as are typed with /* /* /*. It is not universal.
I don't know why you don't want to use find
, but using zsh
you can do:
wc -l prometheus/**/*.{yml,json}
9 prometheus/prometheus/alertmanager/config.yml
104 prometheus/prometheus/docker-compose.yml
103 prometheus/prometheus/docker-prometheus.dockerapp/docker-compose.yml
99 prometheus/prometheus/docker-stack.yml
11 prometheus/prometheus/grafana/provisioning/dashboards/dashboard.yml
50 prometheus/prometheus/grafana/provisioning/datasources/datasource.yml
66 prometheus/prometheus/prometheus/prometheus.yml
114 prometheus/prometheus/pwd-stack.yml
30 prometheus/prometheus.yml
614 prometheus/prometheus/dashboards/Grafana_Dashboard.json
1237 prometheus/prometheus/dashboards/Grafana_Dashboard_prom_2.json
749 prometheus/prometheus/dashboards/System_Monitoring.json
689 prometheus/prometheus/Grafana_Dashboard.json
712 prometheus/prometheus/Grafana Dashboard With Service.json
1581 prometheus/prometheus/grafana/provisioning/dashboards/Docker Prometheus Monitoring-1533038455876.json
258 prometheus/prometheus/HighLoadDashboard.json