我想计算文件中的字母。它们处于不同的级别。 我用过
wc -m `ls -R`
但是,它仅适用于当前目录中的文件。我需要列出完整路径或扩展wc范围。
我尝试使用
ls -d -1 $PWD/*
如其他答案所暗示的那样,但它绝不是递归的。它打印与/ * / * / *键入的级别一样多的级别。它不是通用的。
答案 0 :(得分:0)
我不知道您为什么不想使用find
,但是您可以使用zsh
:
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