sh xargs的

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh xargs的相关的知识,希望对你有一定的参考价值。

# xargs takes a list of arguments and invokes the following command on each item in the list

# Demo: xargs

# Make some files with duplicates
➜ touch fileA
➜ touch fileA-duplicate
➜ touch fileB
➜ touch fileB-duplicate
➜ touch fileC
➜ touch fileC-duplicate

# Sanity: list all files
➜ ls
fileA 
fileA-duplicate
fileB
fileB-duplicate
fileC
fileC-duplicate

# List all files that match a pattern. (e.g. files with the "duplicate" postfix
➜ ls | grep "-duplicate"
fileA-duplicate
fileB-duplicate
fileC-duplicate

# rm -rf is a destructive function that takes a file name
# Usage: rm -rf (aka trash) to a list of duplicate file names
➜ ls | grep "-duplicate" | xargs rm -rf
➜ ls
fileA 
fileB
fileC
➜

以上是关于sh xargs的的主要内容,如果未能解决你的问题,请参考以下文章

sh xargs的

sh xargs的

sh 2つの引数を取るxargs的

sh xargs util

sh xargs继续出错

sh 使用xargs进行并行化