Hello How can I grep only match before : mark?
:
If I run grep test1 file, it shows all three lines.
grep test1 file
test1:x:29688:test1,test2 te
As your data is in row, columns delimited by a character, you may consider awk:
awk
awk -F: '$1 == "test1"' file