extracting восходи from в text file

I am trying to extract в дату (temperature) from в text file downloaded from wget.

eg. wget http://www.weatherzone.com.au/sa/adelaide/adelaide

How to I extract the information which is "18.6" from the file and copy it to another file to be used by another application?

less adelaide
---snip---
'<span id="top_obs_temp" class="tempnow">18.6&deg;C</span>'
---snip---

ТЕТЯ

0
задан 6 November 2015 в 10:08

1 ответ

Используйте awk

$ wget http://www.weatherzone.com.au/sa/adelaide/adelaide
$ awk  -F '[<|>|&]' '/tempnow/ {print $3}' adelaide
20.0

или единый

$ wget -q -O- http://www.weatherzone.com.au/sa/adelaide/adelaide | awk  -F '[<|>|&]' '/tempnow/ {print $3}' 
20.1

, Это работает, пока атрибут class со значением tempnow доступен в эти span тег.

<span id="top_obs_temp" class="tempnow">18.6&deg;C</span>
<час>

И теперь я помещен в черный список o_O :P

wget http://www.weatherzone.com.au/sa/adelaide/adelaide                                                  
--2015-11-06 08:17:37--  http://www.weatherzone.com.au/sa/adelaide/adelaide
Resolving www.weatherzone.com.au (www.weatherzone.com.au)... 104.101.241.181
Connecting to www.weatherzone.com.au (www.weatherzone.com.au)|104.101.241.181|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-11-06 08:17:37 ERROR 403: Forbidden.

0
ответ дан 28 July 2019 в 09:35

Другие вопросы по тегам:

Похожие вопросы: