Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to download an http link from here.

The URL is

http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE48191&format=file

When I use

wget http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE48191&format=file 

I get only index.html?acc=GSE48191 which is some kind of binary format.

How can I download the files under this http link?

share|improve this question

2 Answers 2

I think your ? gets interpreted by shell (Correction by vinc17: more likely, it's the & which gets interpreted).

Just try with simple quotes around your URL:

wget 'http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE48191&format=file'

Note that the file you are requesting is a .tar file but the above command will save it as index.html?acc=GSE48191&format=file. To have it correctly named, you can either rename it to .tar:

mv 'index.html?acc=GSE48191&format=file' GSE4819.tar

Or you can give the name as an option to wget:

wget -O GSE48191.tar 'http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE48191&format=file'

The above command will save the downloaded file as GSE48191.tar directly.

share|improve this answer
    
It gets downloaded but it is not even a directory. If you look at the link ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE48191 , you can see there are multiple .gz files. I still can't access them?? –  user3138373 Jul 22 at 16:57
    
I suppose that the OP uses a shell that ignores ? as a wildcard since nothing matches. The main problem is &: this will run the part that precedes (thus with an incomplete URL) in the background. But the solution is the same: to quote the URL. –  vinc17 Jul 22 at 17:07
    
Thanks to you terdon and vinc for edit/corrections. @user3138373: I can't find your .gz files on provided links, could you please tell again what URL you use to see/access them? –  Qeole Jul 22 at 17:10
1  
@user3138373 the file you download is an archive (.tar file) that contains the .gz files. Once you have downloaded it, run tar xvf GSE4819.tar to expand the archive and access the files. –  terdon Jul 22 at 17:25

Another way that might possibly work is by using this command:

wget -O nameOfTar.tar "http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE48191&format=file"

The -O command will specify the name to download to.

Of course, your initial problem is because the "&" was being interpreted by the shell, surrounding the URL with double quotes fixes the issue.

share|improve this answer
2  
-O option is used to specify the name of the file in which dowloaded data is saved. It has no incidence on downloaded data (maybe that's what you meant, but I found it unclear). –  Qeole Jul 22 at 17:16
    
Yes sorry, I will make my correction –  ryekayo Jul 22 at 17:17
    
I'm not sure why this got downvoted. –  ryekayo Jul 22 at 17:51
3  
I did not downvote, but that's probably because your solution does not fix problem: & is interpreted by shell, and download of .tar file will fail. –  Qeole Jul 22 at 17:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.