I'm trying to grep username:
users | grep "^\b\w*\b" -P
How can I get it to only show the first match with
If you really want return just the first word and want to do this with
Yet, as @manatwork mentioned, shell built-in
To show only the first match with
If you want to store it in a variable, using bash:
Above answer based on @manatwork comments.