So I'm trying to practice regex with sed on linux. I've got these lines:
│ .--. 3..6 °C │ _ /"".-. 6..8 °C │ _ /"".-. 2..6 °C │ _ /"".-. 0..4 °C │
│ _ /"".-. -2..+3 °C │ _ /"".-. 1..5 °C │ ,\_( ). 1..4 °C │ ,\_( ). -1..+2 °C │
│ ( ). -1..+1 °C │ ( ). -2..+2 °C │ ( ). -4..+2 °C │ ( ). -4..+2 °C │
How can I extract only numbers and their sign? But every single on of them? I'm very sloppy with using groups and regexes, and any tip and explanation would help. I got this regex which can shorten the problem, but I still can't extract every single match. I hope it can help.
sed -n -E "/[+-]?[0-9]+\.{2}[+-]?[0-9]+/p"
I want my output to be 3,6 6,8 2,6 0,4 if done on first line, for second and third:
-2,+3 1,5 1,4 -1,+2
-1,+1 -2,+2 -4,+2 -4,+2
°C
.grep -Eo "[-+]*[0-9]+\.\.[-+]*[0-9]+"
, but since that does not produce the output formatted in the way you asked for, I just leave it as a comment.