xargs使用之空格处理

  1. xargs指定分隔符为' ' (默认用空格分隔)
    locate xxx | xargs -d ' ' ls -l
  2. xargs使用 -0 参数会以字符串的''结尾为分隔符,可以在文本传给xargs把' '替换为''
    locate xxx |tr ' ' '' | xargs -0 ls -l
  3. 如果使用find命令,可以使用find的-print0参数以''作为每个结果的结束符
    find ./ -name xx* -print0|xargs -0 ls -l

https://blog.csdn.net/qingsong3333/article/details/77600883?utm_source=blogxgwz3

原文地址:https://www.cnblogs.com/dylanchu/p/11269654.html