dimanche 20 octobre 2019

sed selects last occurence instead of first

I only want to select the first occurrence of a pattern on the line, e.g. the '53.0' instead I get:

$ echo  "Core 0: +53.0°C (high = +80.0°C, crit = +100.0°C)" |
  sed -n 's/.*+\([0-9.]*\).*/\1/p'

which, for me, prints: 100.0 when I expected: 53.0.

I am using Ubuntu 18.04.3 LTS.

What am I missing?

Aucun commentaire:

Enregistrer un commentaire