wget files matching regex code example
Example: wget files matching regex
# Getting http://some/site/*my_pattern*
SITE="http://some/site/"
PATTERN="my_pattern"
wget -nv -O- $SITE |
grep $PATTERN |
awk -v pat=$PATTERN -F '"' '{ for (i=1; i<=NF; ++i) { if ($i ~ pat) print $i } }' |
while read x; do
if [[ ! $x = ">" ]] ; then
wget $SITE$x &>/dev/null
echo $x
fi