如何让wc命令递归?

1.6*_*618 -1 linux

让它计算子目录中的*.h*.cpp.

the*_*ega 5

如果你想要每个文件分开:

find -type f \( -name "*.h" -o -name "*.cpp" \) -exec wc {} \;
Run Code Online (Sandbox Code Playgroud)

如果你想要累积的金额:

find -type f \( -name "*.h" -o -name "*.cpp" \) -exec cat {} \; | wc -l
Run Code Online (Sandbox Code Playgroud)