且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

wget并行下载文件并重命名

更新时间:2023-12-05 20:44:16

您收到的错误是因为您只传递了一个参数 -n 1 使其起作用,您需要传递2参数,请尝试以下方法:

The error you are getting is because you are only passing one argument -n 1 to make it work you need to pass the 2 arguments, try this:

cat list.txt | xargs -n 2 -P 4 wget -O

要将全行用作@Pesa作为参数建议您可以使用选项 -L 1 ,例如:

To use the full line as an argument as @PesaThe suggested you could use option -L 1, for example:

xargs < list.txt -P 4 -L 1 wget -O

从男人那里来:

 -L number
     Call utility for every number non-empty lines read. 
     A line ending with a space continues to the next non-empty line. 
     If EOF is reached and fewer lines have been read than number then utility 
     will be called with the available lines.  The -L and -n options are
     mutually-exclusive; the last one given will be used.