[英]I'm using xargs, but the argument list is too long
I'm using Linux.我正在使用 Linux。 I have a directory tree with over 100,000 files that originated on a MS Windows system.
我有一个目录树,其中包含超过 100,000 个文件,这些文件源自 MS Windows 系统。 Some of the files have spaces in their names.
有些文件的名称中有空格。 I want to convert those files to unix.
我想将这些文件转换为 unix。 I ran this command
我运行了这个命令
find . -type f | xargs -0 dos2unix
And received this error message并收到此错误消息
xargs: argument line too long
How can I fix this?我怎样才能解决这个问题?
If you want to use xargs
with -0
to prevent issues with spaces/special characters in file names you must also use -print0
with find
so it will delimit its output with null bytes:如果要将
xargs
与-0
一起使用以防止文件名中的空格/特殊字符出现问题,则还必须将-print0
与find
一起使用,以便它将 output 与 null 字节分隔:
find . -type f -print0 | xargs -0 dos2unix
You don't need xargs here, you can do你在这里不需要 xargs ,你可以做
find . -type f -exec dos2unix '{}' +
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.