Loading

xargs使用之空格处理

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

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

posted @ 2019-07-30 14:01  dylanchu  阅读(1786)  评论(0编辑  收藏  举报