The goal:
I have a list of people in teams. The list looks something like this
$1 = Job Position (marketing, IT, PR)
$2 = Name
$3 = Team Name
$4 = Targeted member (somebody in field 2 targets somebody else)
$5 = Employment Status (full time/part time/etc)
The idea is to search through the second field and spit out the lines that have the search results. The problem is since everybody who is in field 2 is also in field 4 (since everybody is targetted at least once) I'm getting double the results I want. I just want to search through the second field.
I'm trying to have a simple line of code that will look into the second field of a list, and use a regular expression to search that field and print it out. This is what I have, which I think should work, but it won't, and i'm fresh out of ideas. Any assistance would be helpful.
like
awk -F, ' /John/{print $0}' myfile
does the trick, it finds any line with john, fantastic. HOWEVER, my goal is to find all the Johns in ONE field.
awk -F, ' { if($4=="John") print $0} ' myfile
now this line of code should work (and returns nothing even when the first line returns the correct entries) but even if it did, it finds precisely John, where i'd also like to find any name that might make up John, ie, ohn.
I know that sounds like a grep problem but i'm having trouble dealing with grep even more then awk which i'm sure is how to go about doing this problem.
any and all help greatly appreciated.