i have list of uri: uri.txt with
category1/image1.jpeg category1/image32.jpeg category2/image1.jpeg and on, , need download them domain example.com wget, additional changing filename (final @ save) categoryx-imagey.jpeg
i understand, should read uri.txt line line, add "http://example.com/" in front of each line , change "/" "-" in each line.
what have now:
- reading uri.txt [work]
- adding domain name in front of each uri [work]
- change filename save [fail]
i'm trying with:
wget 'http://www.example.com/{}' -o '`sed "s/\//-/" {}`' < uri.txt but wget fails (it depends type of quotation sign i'm using: ` or ') with:
wget: option requires argument -- 'o' or
sed `s/\//-/` category1/image1.jpeg: no such file or directory sed `s/\//-/` category1/image32.jpeg: no such file or directory could tell, i'm doing wrong?
here how that:
while read line ; wget "http://example.com/$line" -o $(echo $line|sed 's=/=-=') done < uri.txt in other words, read uri.txt line line (the text being placed in $line bash variable), before performing wget , saving modified name (i use sed delimitor, avoid escaping / , making more readable)
Comments
Post a Comment