I have a file with 130 links to make downloads via wget
, all files are with links listed such as:
http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP001,743727846.rar
http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP002,743718235.rar
http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP003,743703720.rar
But I have to edit the file that contains these links and leave them like this:
#Thundercats-EP001.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP001,743727846.rar
wget -O Thundercats-EP001.rar "http://s8580.minhateca.com.br/File.aspx?e=B80c6ks-HZZR2HnE2P_Qj0fY-7MZkLDpI14Qrtckc2t05nqVSDeWdt9kcRhuVHjt_FcwOfwZWuehkAwz613_Df_nzlazlznNiZD2vqM-PO0ST7b3hOVRZD_8WmGTRL3OKB3FEbcAqy5_olQ5syvbgA&pv=2"
unrar e Thundercats-EP001.rar
#Thundercats-EP002.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP002,743718235.rar
wget -O Thundercats-EP002.rar "http://s8562.minhateca.com.br/File.aspx?e=aoEnt8uY-4ccqVF8bEQ7dbdJcsgPlkKl8zLQUXjU-WZzX-PJlAOxeNOvuRDm-9MNxnRB3_9psA36wqfRAycHXgldFGoxz_xaENafIQ6t_yhtWLYgyeh-5nHQdyht6tFxb-mOJBFXvaBfgu5L0zK12A&pv=2"
unrar e Thundercats-EP002.rar
#Thundercats-EP003.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP003,743703720.rar
wget -O Thundercats-EP003.rar "http://s8581.minhateca.com.br/File.aspx?e=K218wb9_yo9qMQ9KU174NRrct9sJ_Kg-Y27HmaoOGAmCsFRDMzz0GnAu8zso-EzVYxKTYM2w1Fh7-m1eyCmFzf2RWQzzdc4ZguCKj72cV0xt3RxggUicqrUotOBzbxr5P4EXUpsPSdgT6lhkL1XmbA&pv=2"
unrar e Thundercats-EP003.rar
Then I made a program that edits this but it instead of enumerating next, it is editing as follows:
#Thundercats-EP001.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP001,743727846.rar
wget -O Thundercats-EP001.rar ""
unrar e Thundercats-EP001.rar
#Thundercats-EP001.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP002,743718235.rar
wget -O Thundercats-EP001.rar ""
unrar e Thundercats-EP001.rar
#Thundercats-EP001.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP003,743703720.rar
wget -O Thundercats-EP001.rar ""
unrar e Thundercats-EP001.rar
When should you edit like this:
#Thundercats-EP001.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP001,743727846.rar
wget -O Thundercats-EP001.rar ""
unrar e Thundercats-EP001.rar
#Thundercats-EP002.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP002,743718235.rar
wget -O Thundercats-EP002.rar ""
unrar e Thundercats-EP002.rar
#Thundercats-EP003.rar
#http://minhateca.com.br/Animesdojonny/Desenhos/THUNDERCATS/Thundercats+-+Completo/Thundercats-EP003,743703720.rar
wget -O Thundercats-EP003.rar ""
unrar e Thundercats-EP003.rar
the program is this below:
#!/bin/bash
LOCATES=${LOCATES:-$(find . -name "downloads")}
ALL_NAMES=${ALL_NAMES:-$(cat ${LOCATES} | cut -f8 -d /)}
ALL_LINKS=${ALL_LINKS:-$(cat ${LOCATES})}
VEC_NAMES=(${ALL_NAMES})
VEC_LINKS=(${ALL_LINKS})
echo ""
for ((l = 1; l <= ${#VEC_NAMES[@]}; l++))
do
NAMES=$(printf "%s%03u.%s" "${ALL_NAMES:0:14}" ${l} "${ALL_NAMES:28:3}")
sed -i 's/^/#'${NAMES}'\n#/g;s/$/\nwget -O '${NAMES}' '\"\"'\nunrar e '${NAMES}'\n\n/g;' ${LOCATES}
done #fim primeiro for
What is my error?