执行以下命令,想要统计当前目录下所有markdown
文件的内容行数。
find . -name "*.md"|xargs cat|wc -l
结果报错了:
xargs: unterminated quote
find
命令找出的文件名包含了空格,导致这一个报错。
find . -name "*.md" -print0|xargs -0 cat|wc -l
man xargs
可以找到以下说明:
-0 Change xargs to expect NUL (``\0'') characters as separators, instead of spaces and newlines. This is expected to be used in concert with the -print0 function in find(1).