2017-11-09 14 views
1

一度に複数の引数を持つコマンドをいくつかの制限まで呼び出すことは可能ですか?複数の引数を一度にgnuと同時に返します

ただ、説明のため、簡単な例のために...

は、いくつかのファイルを作成します。 seq 10 | parallel touch test_files{}.txt

それらを削除するには、私が行うことができます:rm ./test_files*.txtを、

GNU平行な

または同等の:ls ./test_files*.txt | parallel rmrmを各ファイルに対して1回実行します。

rm test_files1.txt test_files2.txt test_files3.txt test_files4.txt test_files5.txt 
rm test_files6.txt test_files7.txt test_files8.txt test_files9.txt test_files10.txt 
+0

それとも、可能性を発売する...のように、引数の最大数を指定して、コマンドを実行するために

ls ./test_files*.txt | parallel --max-args 5 rm''' 

をGNU平行に指示するいくつかの方法があります'ls testfiles * .txt |を使用してください。パラレル-X rm'を実行します。これは 'rm'の各呼び出しに対してOSが許す限り多くのファイルを渡します。 –

答えて

1
$ seq 10 | parallel --max-args 5 echo 
1 2 3 4 5 
6 7 8 9 10 
関連する問題