Try this: egrep '[^A-Za-z0-9]'.
This will look for any line with any character not (^) in [A-Za-z0-9] and set status to 0 if at least one is found.
So the word 'asd#s!' is found invalid because it contains some invalid chars.
While egrep -v '[A-Za-z0-9]'
looked for lines with not a single character from the set [A-Za-z0-9].
So the word 'asd#s!' was not found invalid because it contains at least one valid char.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.