Reputation: 3619
So, I am trying to match a string to some lines in a file. Now, the lines in the files are in the format:
peeyush (#$#@$)
peeyush-gupta ($%%&%)
Now, my problem is when I try to search 'peeyush', I should get only first line as the output. Till now, I have been doing this:
line='peeyush'
grep $line test.txt
Now, the search string would definitely come in a variable as this thing is going in loop. So, this gives me both the string as result. I want to match the string 'peeyush ' (with a space), while it's matching without spaces.
Upvotes: 0
Views: 51