1

does anybody know the exact command I have to use to download part of a website that consists of more than one page (with wget). Example:

I want to download a certain page which exists within a forum. There´s an article dealing with "stderr" within this forum.

The address is : "https://forum.ubuntuusers.de/topic/stderr-umleitungen/" AND "https://forum.ubuntuusers.de/topic/stderr-umleitungen/2/" as it consists of two pages.

What I want to do is download both pages with one command, but not the entire forum. How do I go about typing the correct command?

System: Linux/Lubuntu 16.04.2 LTS, 64bit

1 Answer 1

1
wget -Ek https://example.com/foo/bar/{,2}

The last bit {,2} is a brace expansion which instructs wget to download:

https://example.com/foo/bar/
https://example.com/foo/bar/2

To download pages 3 through 6, use either of these commands:

wget -Ek https://example.com/foo/bar/{3,4,5,6}
wget -Ek https://example.com/foo/bar/{3..6}

And there are a couple of really useful wget options: -E and -k.

-E: If a file of type "text/html" is downloaded and the URL does not end with the regexp `\.[Hh][Tt][Mm][Ll]?', this option will cause the suffix ".html" to be appended to the local filename.

-k: After the download is complete, convert the links in the document to make them suitable for local viewing (i.e., convert relative links to absolute links).

Please read the wget man page and manual for more information.

2
  • Hi TooManyPets. Tnx a lot for your reply. This command of yours works like a charm. That´s really what I was looking for. Tnx also for the links. As far as the man pages are concerned I really couldn´t find the right command for downloading more than one page "{" and "}" actually never show up in the man-pages. Greetings. Rosika
    – Rosika
    Feb 26, 2017 at 12:10
  • Your're welcome. Please have a look at these suggestions when you have a moment. Feb 26, 2017 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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