How can I make wget command to read http link with spaces from file?

1

The following link image has a space:

http://descripciones.intcomex.cl/userfiles/image/210-1140LA XA509LA_190x170.jpg

I can get the image using:

wget "http://descripciones.intcomex.cl/userfiles/image/210-1140LA XA509LA_190x170.jpg"

However, as I have multiple links, I am doing it using a file, like this:

wget -i image_links.txt

The "wget" commmand won't read the links with spaces from the file. I have try using the following links inside the file (double comma, backslash before the space):

"http://descripciones.intcomex.cl/userfiles/image/210-1140LA XA509LA_190x170.jpg"
"http://descripciones.intcomex.cl/userfiles/image/210-1140LA\ XA509LA_190x170.jpg"

But none of them work. Does anyone know how I can get it working?

Nicolas

Posted 2010-07-27T15:06:22.887

Reputation: 11

Answers

5

If you put each HTTP URL on a line of its own, it should work:

http://server.com/file with space1
http://server.com/file with space2

This works for me (GNU wget 1.11.4).

Alternatively, you can URL-escape the spaces, by replacing them with %20, as in

http://server.com/file%20with%20space1

sleske

Posted 2010-07-27T15:06:22.887

Reputation: 19 887

0

Put each URL on one line and make sure to use UNIX line endings for the .txt file.

I used the following script provided by Python to accomplish this in Windows:

python C:\Python27\Tools\scripts\crlf.py textfile.txt

Gfy

Posted 2010-07-27T15:06:22.887

Reputation: 123