Monday, 30 September 2013

how to check if a substring exist

how to check if a substring exist

I have the following string
msg="bbb. aaa.ccc. bbb.dddd. aaa.eee."
the separator between the sub strings is the space.
I want to check for example if "aaa." exist. in the above msg it does not
exist.
I want to check for example if "bbb." exist. in the above msg it exists.
I tried with grep, but grep works with newlines as the separators between
substrings
How to do that?

No comments:

Post a Comment