1) man cat
2) man head, man tail
3) use a regx "^" char specified befor your search pattern says this pattern must be @ the beggining of a line.
the $ says the search pattern must be at the end of the line.
ie:
^joebobjames (this says joebobjames must be present at the beginning of the line.
jobobjames$ (this says joebobjames must be present at the end of the line.