Example command:
echo "am lorem-ipsum dolor" | grep -w -- lorem
This should return nothing, because "lorem" is not a whole word.
This word contains "-" character.
Any idea?
CodePudding user response:
For grep
, word-constituent characters are letters, digits, and the underscore.
Therefore, hyphen is not a word-constituent and splits words.