Saturday 18 April 2009

searching for exact string

If i want to get the lines containing exact word ignoring the lines which consists of same word embedded as part of another word,i can use grep like this:

$inputline = "sriram sriraman raja rajaram"

sol : echo $inputline | grep '\&ltsriram\&gt' selects the line containing a separate word sriram, but not the line which contains words like sriraman sriramkumar etc..

No comments:

Post a Comment

Tweets by @sriramperumalla