I'm having a weird problem with running a simple curl command inside a while loop. I have a list of links in a txt file which I want to process. The problem is that I am getting the bad/illegal URL error:
curl: (3) URL using bad/illegal format or missing URL
Here is the code (Accessions.txt has the list of URLs, one per line):
awk -F "," '{print $12}' "$INPUT" | sed 's,/[^/]*$,,' | sort | uniq > Accessions.txt
while read -r line; do curl -I "$line"; done < Accessions.txt
All links have this pattern: https://foo.bar.org/xxxx/xxxxxxxxxxx
What's weird is that if I pass the links one by one in curl they work fine e.g. curl -I https://foo.bar.org/xxxx/xxxxxxxxxxx
Any suggestions?