antonn,
The reason it seems to work is due to your specific data set. The solution without modification is fragile. This is because grep assumes that the file contains regular expressions (called patterns) not fixed strings. It would be better to add the -F option as shown by bellaire to treat them as fixed strings.