Reputation: 4787
I have some string which include "." as part of it example
VCAT.VSCH.VIVEK
VIVEK
I want to grep the sting which include ".vivek". i tried using grep -iw ".vivek" but it return no data. please help me finding the string.
Thanks in advance Vivek
Upvotes: 1
Views: 265
Reputation: 627180
You should remove w
and use
s="VCAT.VSCH.VIVEK
VIVEK"
grep -i '\.vivek' <<< "$s"
# => VCAT.VSCH.VIVEK
See the online demo
Or, with a word boundary at the end to match vivek
and not viveks
:
grep -i '\.vivek\b' <<< "$s"
See another grep demo.
Upvotes: 1