Reputation: 33
I want to get the random page from wiki and paste it on txt file.
curl -I https://en.wikipedia.org/wiki/Special:Random|grep -E "Location:"|cut -d ' ' -f2 > "result.txt"
But when I retrieve it from txt file and it come out the error.
cat result.txt| xargs -I % curl %
Upvotes: 0
Views: 3943
Reputation: 27822
How about just following redirects with curl
by adding the -L
switch? No need to parse the Location
header:
curl -L https://en.wikipedia.org/wiki/Special:Random
Upvotes: 1