regex - Match only first occurrence of digit -


after few hours of disappointed searching can't figure out.

i piping grep input, want first occurrence of digit.

example:

nmcli --version nmcli tool, version 1.1.93 

pipe grep regex

nmcli --version |grep -o '[[:digit:]]' 

output:

1 1 9 3 

what want:

1 

yeah there way pipe, there "pure" single regex that?

with gnu grep:

nmcli --version | grep -po ' \k[[:digit:]]' 

output:

 1 

see: support of \k in regex


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo