shell scripting match leading numbers

In shell scripting I need to yank out leading numbers,  in the examples host below I need it to match any leading numbers then stop whenever the next characters is not number.

result I want:  99
result I want: 1000
result I want: nothing
Who is Participating?

Improve company productivity with a Business Account.Sign Up

pivarConnect With a Mentor Commented:

How about? If it's from a file.

grep -o '^[0-9]*' filename

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.