Print lines starting with an even number

Viewed 71

I have the following input,

10
12    a
12 a
14a

The following command

sed -rn '/^[0-9]*[02468]\s/p'

(or an equivalent grep command) returns

12    a   
12 a

only and not 10 because there is an EOL following 10. On the other hand, if I drop the \s, 14a is also returned, which is not a number.

Thanks!

2 Answers
Related