xargs with multiple arguments

后端 未结 12 1753
独厮守ぢ
独厮守ぢ 2020-12-13 08:05

I have a source input, input.txt

a.txt
b.txt
c.txt

I want to feed these input into a program as the following:

<         


        
12条回答
  •  遥遥无期
    2020-12-13 08:40

    How about:

    echo $'a.txt\nb.txt\nc.txt' | xargs -n 3 sh -c '
       echo my-program --file="$1" --file="$2" --file="$3"
    ' argv0
    

提交回复
热议问题