wget -q -O- "http://www.rss-specifications.com/rss-podcast.xml" | grep -o '<enclosure url="[^"]*' | grep -o '[^"]*$' | xargs wget -c
当然这并不适用于所有情况,但通常已经足够好了。
我编写了以下简单的脚本来从Amazon S3下载XML,因此它可用于解析不同类型的XML文件:
#!/bin/bash
#
# Download all files from the Amazon feed
#
# Usage:
# ./dl_amazon_feed_files.sh http://example.s3.amazonaws.com/
# Note: Don't forget about slash at the end
#
wget -qO- "$1" | grep -o '<Key>[^<]*' | grep -o "[^>]*$" | xargs -I% -L1 wget -c "$1%"