我需要在Bash腳本中獲取一些超級引用。如何將string()函數應用於每個屬性?
以下命令使用curl
和xmllint
讀取HTML頁面的所有href
屬性:
curl --silent -L google.com | xmllint --html --xpath '//a/@href' -
但我需要的屬性的唯一值。可以使用string()
函數來選擇屬性的值。但是,如果使用它,我只得到的屬性列表的第一個元素:
curl --silent -L google.com | xmllint --html --xpath 'string(//a/@href)' -
如何申請在該string()
功能,每個屬性?
with xpath 2它會是'// a/@ href/string()',但它在xmllint(尚未)中不可用 – 2014-11-14 15:29:37