📜  wget 文件匹配正则表达式 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:07.402000             🧑  作者: Mango

代码示例1
# 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