I am confused about the following command
$ cat num.txt
1
2
3
1st
2nd
3th
$ cat num.txt | grep -Eo '[0-9](?:st|nd|th)?'
I think it should output as
1
2
3
1
2
3
But it output as
1
2
3
1
2nd
3th
What am I doing wrong here?Thanks for any help.