获取 xargs 序列号
Get xargs sequence number
在 GNU Parallel 中你有:
seq() - sequence number of job
多亏了这个,我可以 运行 wget
在 parallel
中使用:
parallel -a urls.txt -j8 wget -q {} -O '{=$_=sprintf("file%05d.ts", $job->seq())=}'
..它会这样命名文件:
file00001.ts
file00002.ts
...
file00999.ts
现在,如何获取xargs
的序列号?
示例:
xargs -P 8 -n 1 curl -O < urls.txt
像这样:
cat urls.txt |
parallel --shellquote |
parallel --shellquote |
perl -pe 's/(.*)/.sprintf(" -O file%05d.ts",++$t)/e' |
xargs -P 8 -n 1 -I {} bash -c "wget {}"
如果您的网址包含特殊字符,例如 space 和 ':
,则需要 2 个 --shellquote
http://pi.dk/? '
在 GNU Parallel 中你有:
seq() - sequence number of job
多亏了这个,我可以 运行 wget
在 parallel
中使用:
parallel -a urls.txt -j8 wget -q {} -O '{=$_=sprintf("file%05d.ts", $job->seq())=}'
..它会这样命名文件:
file00001.ts
file00002.ts
...
file00999.ts
现在,如何获取xargs
的序列号?
示例:
xargs -P 8 -n 1 curl -O < urls.txt
像这样:
cat urls.txt |
parallel --shellquote |
parallel --shellquote |
perl -pe 's/(.*)/.sprintf(" -O file%05d.ts",++$t)/e' |
xargs -P 8 -n 1 -I {} bash -c "wget {}"
如果您的网址包含特殊字符,例如 space 和 ':
,则需要 2 个--shellquote
http://pi.dk/? '