How can I pass all arguments with xargs in middle of command in linux

前端 未结 8 2099
一个人的身影
一个人的身影 2020-12-09 08:37

I want to pass all the files as a single argument on Linux but I am not able to do that.

This is working

ls | sort -n | xargs  -i pdftk  {} cat outpu         


        
8条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 08:58

    You can do this by chaining two calls to xargs. Use the first to chain all of the args together into one string and pass that as a param to echo, and the second using -I to place that chain of args into the place where you want it, as follows:

    ls | sort -n | xargs echo | xargs -I {} pdftk {} cat output combinewd2.pdf
    

提交回复
热议问题