in reply to wgetas - download many small files by HTTP, saving to filename of your choice

=item B<-i> I<listfile> Gives a file that lists the URLs to download and filenames to save it: each line has a HTTP URL and a filename separated by whitespace. The filename cannot contain whitespace.

Why that limitation? No URL can contain white space, but filenames can. So, split on the first white space, and perhaps remove extra white space before EOL to avoid nasty surprises.

my($uri, $fnamej, $rest) = split " ", $spec; length($rest) and die "invalid spec (too many words, line $.): $sp +ec";
becomes
$spec=~s/\s+$//; my ($uri,$fnamej)=split /\s+/,$spec,2;

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: wgetas - download many small files by HTTP, saving to filename of your choice
by ambrus (Abbot) on Oct 22, 2011 at 22:06 UTC

    You could do that if you want to. I just thought I might possibly want to add extra fields to the file format later.

    But yes, I'm aware of this trick. I'm storing my collection of (public) bookmarks in a text file where each line has the URL as the last whitespace-separated field, and generating HTML pages automatically uploaded to my homepage from them.