Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -O -b cookie $URL
- while read edition; do XML="<?xml version="1.0"
- encoding="UTF-8"?> <download-area> <files>
- <file>
- <url>https://google.com/411/201701_01_01.zip</url>
- </file>
- <file>
- <url>https://google.com/411/201701_01_02.zip</url>
- </file> </files> </download-area>
- "
- URL=$(echo $XML | xmllint --xpath
- "/*[name()='download-area']/*[name()='files']/*[name()='file']/*[name()='url']/text()" -)
- echo "URL:: " $URL
- done < $LATEST_EDITION
- declate -a url_array
- url_array=(`echo $XML | grep -o "http.*zip" | tr 'n' ' '`)
- #!/bin/bash
- XML='<?xml version="1.0" encoding="UTF-8"?>
- <download-area>
- <files>
- <file>
- <url>https://google.com/411/201701_01_01.zip</url>
- </file>
- <file>
- <url>https://google.com/411/201701_01_02.zip</url>
- </file>
- </files>
- </download-area>'
- # IFS=$'n' ## required if URLs contains spaces
- urls=( $(xml select -t -m "/download-area/files/file" -v url -nl <<< $XML ) )
- declare -A unique # associative array
- for uu in ${urls[*]}; do let unique[$uu]++; done
- for uu in "${!unique[@]}"; do
- printf "URL is %sn" ${uu}
- done
- declare -A unique=([https://google.com/411/201701_01_01.zip]="1"
- [https://google.com/411/201701_01_02.zip]="1" )
- while read line; do
- [[ -n "$line" ]] && let unique[$line]++
- done < <(xml sel -t -m "/download-area/files/file" -v url -nl <<< $XML)
Add Comment
Please, Sign In to add comment