0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

シェル学習 xargsによる一括処理

Posted at

####xargsによる一括処理

xargs→コマンドに引数を渡して実行してもらう

1,2,3,4という名前のディレクトリを作成する
$ seq 4 | xargs mkdir

ディレクトリ1,2,3,4を削除する
$ seq 4 | xargs rmdir

1,3という名前のディレクトリを作成しておき、それぞれを2,4という名前に変更
$ mkdir 1 3
$ seq 4 | xargs -n2 mv
xargs -n個数で「入力された文字列を指定した個数ずつコマンドに渡す」

dir_1,dir_2,dir_3,dir_4という名前の4個のディレクトリを作成
$ seq 4 | xargs -I@ mkdir dir_@
@のところに、xargsが受け取った文字列を1つずつ入れる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?