I have a file that looks like this called listofnames.txt
.
this-is-name-1
this-is-name-2
...
this-is-name-11
this-is-name-12
this-is-name-13
this-is-name-14
...
this-is-name-21
....
I want to do a full match of a certain word and add a "0" next to it. I use the following command:
sed -i '/this-is-name-1/s/$/ 0/' ~/listofnames.txt
However, instead of this,
this-is-name-1 0
this-is-name-2
...
this-is-name-11
this-is-name-12
this-is-name-13
this-is-name-14
...
this-is-name-21
....
I get this,
this-is-name-1 0
this-is-name-2
...
this-is-name-11 0
this-is-name-12 0
this-is-name-13 0
this-is-name-14 0
...
this-is-name-21
....
What is wrong with my command? how do I fix it and do what I need. It seems to be doing a partial match instead of a full match.