Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
 
PREVIOUS NEXT
Tagged: #wget #files #matching #regex
ADD COMMENT
Topic
Name
7+1 =