Extract values from a web page via commandline

I hope, that you can help me with my prepaid subscription. (Vodafone DE)
I uploaded the Raw output to Pastebin

I want to get the remaining volume, the total volume and my balance.
The device is not the OH Server, therefore the command needs to be executed remotely.
Using the http binding would be easier, of course :slight_smile:

My first attempt is this:
wget -q --output-document=- wap.meincallya.de/dr/s/ch | grep (…)

I do not want to get the whole line, which includes my result only the value (one per call)

But actually i am not really good in REGEX strings.
What i want to extract from the file is the following:
<span style="color:#e60000;"> 1,23 € </span> -> 1,23
<span> 123,4 MB von 850 MB verfügbar </span> -> 123,4 and 850

The 850MB are static, but it could be, that the provider will change it in the next time, It is also needed to calculate a percentage.

Use an online regex tester:


Paste the HTML/XML that gets returned and you can experiment with the regular expression as you go.

It is difficult to come up with a reliable REGEX without seeing the whole page because we need to know which parts of that line never change. For example the following could work:

.*color:#e60000\;\"\> [.*] € \</span\>.*

But if there is another span with that color and a euro symbol it will match that too, in which case you would need to add a match selector [1].

The second one could be something like:

.*\<span\> (.*) MB von .* verfügbar \</span\>

And the third would be the same, just shift the parens to the second .*.

I’d calculate the percentage in a rule.