Linux 操作命令 xargs 喜欢ヅ旅行 2022-01-16 15:35 211阅读 0赞 # [Linux Shell 操作命令 目录总览(点击查看详细信息)][Linux Shell _] # # 1、简介 # 简单说 xargs将其接受的字符串 作为 一个命令参数来运行 # 2、用法/命令格式 # command | xargs \{选项\} \{command\} # 3、常用参数解析 # <table> <thead> <tr> <th>参数</th> <th>描述</th> </tr> </thead> <tbody> <tr> <td>-n</td> <td>指定每行最大的参数数量</td> </tr> <tr> <td>-d</td> <td>指定分隔符</td> </tr> </tbody> </table> # 4、范例 # ## 4.1 输出 形式(每行最大 参数数量) ## ## 不指定 分隔符 ,默认 两个 空格 间隔 为 一个 参数 ## -d 指定 每行内容 间隔符 ## -n 指定 每行 显示的列数 # cat {file_name} | xagrs -n {num} -d {symbol} ## 4.2 统计 每个 文件 内容 行数 ## ## 这样 只是 统计 了 符合 条件的 文件数 # find . \( -name "*.tx?" -or -name "*.pdf" \) | wc -l ## 这样 统计 的 是 每个文件 中 内容 行数 # find . \( -name "*.tx?" -or -name "*.pdf" \) | xargs wc -l 转载于:https://blog.51cto.com/11495268/2362576 [Linux Shell _]: https://blog.51cto.com/11495268/2338219
还没有评论,来说两句吧...