With the grep command, you have to know the
pattern you are searching for. So, if you already know you are searching for the name Bobby in a file named grepfile.....
Code:
BASH:~/-> cat grepfile
uid=500(Bobby) gid=500(Bobby)
uid=501(Jim) gid=500(Jim)
Code:
BASH:~/-> grep -o Bobby grepfile
Bobby
Bobby
To grep for names Bobby and Jim
Code:
BASH:~/-> grep -o -e Bobby -e Jim grepfile
Bobby
Bobby
Jim
Jim
If you don't know the names you're searching for, then grep isn't the command you want to use.