'Get the value of count in bash Linux

I have below string like below

<html>
<body>
<h1>|| name: xzy || class: 9 || date: 07-01-2022 || marks:25</h1>
</body>
</html>

I want to retrieve only marks I.e 25 . All the string values keeps changing. The name , date and marks are constant . I just want to get only marks value I.e 25 Please help



Solution 1:[1]

sed -nE '/marks:[[:digit:]]+/s/^.*marks:([[:digit:]]+).*$/\1/p' path/to/file.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rigglesbee