I am trying to grep the following line in a file using a bash shell:
(..)
admin1::14959::::::
(..)
It works with the following expression (as expected)
# cat file | grep ^[a-z0-9]*::
admin1::14959::::::
but it does not work with (not expected)
# cat /etc/shadow | grep ^[a-z0-9]+::
I assume the difference is the + vs. the *. According my
understanding the * matches the preceding character 0 or
more times and the + matches the preceding character 1
or more times. Therefore, the match should be in both cases
"admin1::"
I can not see my mistake. Any ideas ?