如何从链接列表中并行卷曲
How to curl in parallel from a list of links
list.txt 包含链接。我需要它们同时平行卷曲。表示同时卷曲 example.com
、abc.com
和 123.com
。
我试过的
mycurl() {
curl
}
seq 1 | parallel -j0 mycurl list.txt >> output.txt
#I've also tried
seq 1 | parallel -j0 mycurl ::: list.txt >> output.txt
#I"ve also tried
parallel -a list.txt mycurl >> output.txt
他们都并行输出 --help
list.txt 内容
example.com
abc.com
def.com
我看不出你的 mycurl()
函数的意义,但如果你愿意,你可以这样使用它:
# Declare 'mycurl()' function
mycurl() {
# list.txt can be accessed in here if you want
curl
}
# Make 'mycurl()' function available to processes started by 'parallel'
export -f mycurl
# Call 'mycurl()' once with each line of 'list.txt' as parameter
parallel -a list.txt mycurl {} > output.txt
list.txt 包含链接。我需要它们同时平行卷曲。表示同时卷曲 example.com
、abc.com
和 123.com
。
我试过的
mycurl() {
curl
}
seq 1 | parallel -j0 mycurl list.txt >> output.txt
#I've also tried
seq 1 | parallel -j0 mycurl ::: list.txt >> output.txt
#I"ve also tried
parallel -a list.txt mycurl >> output.txt
他们都并行输出 --help
list.txt 内容
example.com
abc.com
def.com
我看不出你的 mycurl()
函数的意义,但如果你愿意,你可以这样使用它:
# Declare 'mycurl()' function
mycurl() {
# list.txt can be accessed in here if you want
curl
}
# Make 'mycurl()' function available to processes started by 'parallel'
export -f mycurl
# Call 'mycurl()' once with each line of 'list.txt' as parameter
parallel -a list.txt mycurl {} > output.txt